From a824b785c584eb934a3a31cd8a6f802cf9f8aceb Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Mon, 7 Apr 2025 15:40:37 +0200 Subject: [PATCH 1/2] Give better signal that orgslug is missing --- src/commands/scan/cmd-scan-create.ts | 9 ++++++--- src/commands/scan/cmd-scan-del.ts | 9 ++++++--- src/commands/scan/cmd-scan-list.ts | 9 ++++++--- src/commands/scan/cmd-scan-metadata.ts | 9 ++++++--- src/commands/scan/cmd-scan-report.ts | 9 ++++++--- src/commands/scan/cmd-scan-view.ts | 9 ++++++--- 6 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/commands/scan/cmd-scan-create.ts b/src/commands/scan/cmd-scan-create.ts index bf74f3f3a..143f6eb55 100644 --- a/src/commands/scan/cmd-scan-create.ts +++ b/src/commands/scan/cmd-scan-create.ts @@ -235,11 +235,14 @@ async function run( const wasBadInput = handleBadInput( { - nook: true, - test: orgSlug, + nook: !!defaultOrgSlug, + test: orgSlug && orgSlug !== '.', message: 'Org name as the first argument', pass: 'ok', - fail: 'missing' + fail: + orgSlug === '.' + ? 'dot is an invalid org, most likely you forget the org name here?' + : 'missing' }, { test: targets.length, diff --git a/src/commands/scan/cmd-scan-del.ts b/src/commands/scan/cmd-scan-del.ts index ee91adb95..6bb607762 100644 --- a/src/commands/scan/cmd-scan-del.ts +++ b/src/commands/scan/cmd-scan-del.ts @@ -62,11 +62,14 @@ async function run( const wasBadInput = handleBadInput( { - nook: true, - test: orgSlug, + nook: !!defaultOrgSlug, + test: orgSlug && orgSlug !== '.', message: 'Org name as the first argument', pass: 'ok', - fail: 'missing' + fail: + orgSlug === '.' + ? 'dot is an invalid org, most likely you forget the org name here?' + : 'missing' }, { test: scanId, diff --git a/src/commands/scan/cmd-scan-list.ts b/src/commands/scan/cmd-scan-list.ts index 2f35c643f..de02ebe82 100644 --- a/src/commands/scan/cmd-scan-list.ts +++ b/src/commands/scan/cmd-scan-list.ts @@ -102,11 +102,14 @@ async function run( const wasBadInput = handleBadInput( { - nook: true, - test: orgSlug, + nook: !!defaultOrgSlug, + test: orgSlug && orgSlug !== '.', message: 'Org name as the first argument', pass: 'ok', - fail: 'missing' + fail: + orgSlug === '.' + ? 'dot is an invalid org, most likely you forget the org name here?' + : 'missing' }, { nook: true, diff --git a/src/commands/scan/cmd-scan-metadata.ts b/src/commands/scan/cmd-scan-metadata.ts index 6a291d458..dc916dcf6 100644 --- a/src/commands/scan/cmd-scan-metadata.ts +++ b/src/commands/scan/cmd-scan-metadata.ts @@ -66,11 +66,14 @@ async function run( const wasBadInput = handleBadInput( { - nook: true, - test: orgSlug, + nook: !!defaultOrgSlug, + test: orgSlug && orgSlug !== '.', message: 'Org name as the first argument', pass: 'ok', - fail: 'missing' + fail: + orgSlug === '.' + ? 'dot is an invalid org, most likely you forget the org name here?' + : 'missing' }, { test: scanId, diff --git a/src/commands/scan/cmd-scan-report.ts b/src/commands/scan/cmd-scan-report.ts index 35d01a592..3f7f8e2d7 100644 --- a/src/commands/scan/cmd-scan-report.ts +++ b/src/commands/scan/cmd-scan-report.ts @@ -105,11 +105,14 @@ async function run( const wasBadInput = handleBadInput( { - nook: true, - test: orgSlug, + nook: !!defaultOrgSlug, + test: orgSlug && orgSlug !== '.', message: 'Org name as the first argument', pass: 'ok', - fail: 'missing' + fail: + orgSlug === '.' + ? 'dot is an invalid org, most likely you forget the org name here?' + : 'missing' }, { test: scanId, diff --git a/src/commands/scan/cmd-scan-view.ts b/src/commands/scan/cmd-scan-view.ts index d1b4c9dc8..8fe9c9750 100644 --- a/src/commands/scan/cmd-scan-view.ts +++ b/src/commands/scan/cmd-scan-view.ts @@ -70,11 +70,14 @@ async function run( const wasBadInput = handleBadInput( { - nook: true, - test: orgSlug, + nook: !!defaultOrgSlug, + test: orgSlug && orgSlug !== '.', message: 'Org name as the first argument', pass: 'ok', - fail: 'missing' + fail: + orgSlug === '.' + ? 'dot is an invalid org, most likely you forget the org name here?' + : 'missing' }, { test: scanId, From 96369c5323705374b0bcb799328d1e3b1b8729b3 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Mon, 7 Apr 2025 15:43:26 +0200 Subject: [PATCH 2/2] o --- src/commands/scan/cmd-scan-create.ts | 2 +- src/commands/scan/cmd-scan-del.ts | 2 +- src/commands/scan/cmd-scan-list.ts | 2 +- src/commands/scan/cmd-scan-metadata.ts | 2 +- src/commands/scan/cmd-scan-report.ts | 2 +- src/commands/scan/cmd-scan-view.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/scan/cmd-scan-create.ts b/src/commands/scan/cmd-scan-create.ts index 143f6eb55..6afac5d88 100644 --- a/src/commands/scan/cmd-scan-create.ts +++ b/src/commands/scan/cmd-scan-create.ts @@ -241,7 +241,7 @@ async function run( pass: 'ok', fail: orgSlug === '.' - ? 'dot is an invalid org, most likely you forget the org name here?' + ? 'dot is an invalid org, most likely you forgot the org name here?' : 'missing' }, { diff --git a/src/commands/scan/cmd-scan-del.ts b/src/commands/scan/cmd-scan-del.ts index 6bb607762..085e18177 100644 --- a/src/commands/scan/cmd-scan-del.ts +++ b/src/commands/scan/cmd-scan-del.ts @@ -68,7 +68,7 @@ async function run( pass: 'ok', fail: orgSlug === '.' - ? 'dot is an invalid org, most likely you forget the org name here?' + ? 'dot is an invalid org, most likely you forgot the org name here?' : 'missing' }, { diff --git a/src/commands/scan/cmd-scan-list.ts b/src/commands/scan/cmd-scan-list.ts index de02ebe82..46196c78d 100644 --- a/src/commands/scan/cmd-scan-list.ts +++ b/src/commands/scan/cmd-scan-list.ts @@ -108,7 +108,7 @@ async function run( pass: 'ok', fail: orgSlug === '.' - ? 'dot is an invalid org, most likely you forget the org name here?' + ? 'dot is an invalid org, most likely you forgot the org name here?' : 'missing' }, { diff --git a/src/commands/scan/cmd-scan-metadata.ts b/src/commands/scan/cmd-scan-metadata.ts index dc916dcf6..0b0a853f5 100644 --- a/src/commands/scan/cmd-scan-metadata.ts +++ b/src/commands/scan/cmd-scan-metadata.ts @@ -72,7 +72,7 @@ async function run( pass: 'ok', fail: orgSlug === '.' - ? 'dot is an invalid org, most likely you forget the org name here?' + ? 'dot is an invalid org, most likely you forgot the org name here?' : 'missing' }, { diff --git a/src/commands/scan/cmd-scan-report.ts b/src/commands/scan/cmd-scan-report.ts index 3f7f8e2d7..a2f200127 100644 --- a/src/commands/scan/cmd-scan-report.ts +++ b/src/commands/scan/cmd-scan-report.ts @@ -111,7 +111,7 @@ async function run( pass: 'ok', fail: orgSlug === '.' - ? 'dot is an invalid org, most likely you forget the org name here?' + ? 'dot is an invalid org, most likely you forgot the org name here?' : 'missing' }, { diff --git a/src/commands/scan/cmd-scan-view.ts b/src/commands/scan/cmd-scan-view.ts index 8fe9c9750..4123a6225 100644 --- a/src/commands/scan/cmd-scan-view.ts +++ b/src/commands/scan/cmd-scan-view.ts @@ -76,7 +76,7 @@ async function run( pass: 'ok', fail: orgSlug === '.' - ? 'dot is an invalid org, most likely you forget the org name here?' + ? 'dot is an invalid org, most likely you forgot the org name here?' : 'missing' }, {