File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " akamai-sandbox-cli" ,
3
- "version" : " 1.1.3 " ,
3
+ "version" : " 1.1.4 " ,
4
4
"description" : " A tool to help manage Akamai Sandboxes. Uses the sandbox {OPEN} API." ,
5
5
"repository" : " https://github.com/akamai/cli-sandbox" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ program
413
413
if ( options . clonable ) {
414
414
sandbox . isClonable = clonable ;
415
415
}
416
- if ( options . name ) {
416
+ if ( isNonEmptyString ( options . name ) ) {
417
417
sandbox . name = options . name ;
418
418
}
419
419
@@ -453,7 +453,7 @@ program
453
453
. action ( async function ( arg , options ) {
454
454
try {
455
455
const sandboxId = getSandboxIdFromIdentifier ( arg ) ;
456
- if ( ! options . name ) {
456
+ if ( ! isNonEmptyString ( options . name ) ) {
457
457
logAndExit ( 'parameter --name is required' ) ;
458
458
}
459
459
const name = options . name ;
@@ -725,6 +725,13 @@ function oneOf(...args: any[]) {
725
725
return r ;
726
726
}
727
727
728
+ function isNonEmptyString ( obj ) {
729
+ return obj !== null
730
+ && obj !== undefined
731
+ && ( typeof obj === 'string' )
732
+ && obj . trim ( ) . length > 0 ;
733
+ }
734
+
728
735
program
729
736
. command ( 'create' )
730
737
. description ( 'create a new sandbox' )
@@ -753,7 +760,7 @@ program
753
760
const hostnameSpecifier = options . hostname ;
754
761
755
762
//validation
756
- if ( ! name ) {
763
+ if ( ! isNonEmptyString ( name ) ) {
757
764
logAndExit ( `You must provide a name for your sandbox` ) ;
758
765
}
759
766
if ( ! oneOf ( propertySpecifier , papiFilePath , hostnameSpecifier ) ) {
You can’t perform that action at this time.
0 commit comments