@@ -529,6 +529,7 @@ async function processInitForm(
529529 name : 'subgraphName' ,
530530 message : 'Subgraph slug' ,
531531 initial : initSubgraphName ,
532+ validate : value => value . length > 0 || 'Subgraph slug must not be empty' ,
532533 result : value => {
533534 initDebugger . extend ( 'processInitForm' ) ( 'subgraphName: %O' , value ) ;
534535 subgraphName = value ;
@@ -541,6 +542,7 @@ async function processInitForm(
541542 name : 'directory' ,
542543 message : 'Directory to create the subgraph in' ,
543544 initial : ( ) => initDirectory || getSubgraphBasename ( subgraphName ) ,
545+ validate : value => value . length > 0 || 'Directory must not be empty' ,
544546 result : value => {
545547 directory = value ;
546548 initDebugger . extend ( 'processInitForm' ) ( 'directory: %O' , value ) ;
@@ -707,7 +709,11 @@ async function processInitForm(
707709 message : 'Start block' ,
708710 initial : ( ) => initStartBlock || startBlock || '0' ,
709711 skip : ( ) => initFromExample !== undefined || isSubstreams ,
710- validate : value => parseInt ( value ) >= 0 ,
712+ validate : value =>
713+ initFromExample !== undefined ||
714+ isSubstreams ||
715+ parseInt ( value ) >= 0 ||
716+ 'Invalid start block' ,
711717 result : value => {
712718 startBlock = value ;
713719 initDebugger . extend ( 'processInitForm' ) ( 'startBlock: %O' , value ) ;
@@ -721,7 +727,12 @@ async function processInitForm(
721727 message : 'Contract name' ,
722728 initial : ( ) => initContractName || contractName || 'Contract' ,
723729 skip : ( ) => initFromExample !== undefined || ! protocolInstance . hasContract ( ) || isSubstreams ,
724- validate : value => value && value . length > 0 ,
730+ validate : value =>
731+ initFromExample !== undefined ||
732+ ! protocolInstance . hasContract ( ) ||
733+ isSubstreams ||
734+ value . length > 0 ||
735+ 'Contract name must not be empty' ,
725736 result : value => {
726737 contractName = value ;
727738 initDebugger . extend ( 'processInitForm' ) ( 'contractName: %O' , value ) ;
@@ -742,8 +753,7 @@ async function processInitForm(
742753 } ,
743754 } ) ;
744755
745- const results = await promptManager . executeInteractive ( ) ;
746- console . log ( 'results' , results ) ;
756+ await promptManager . executeInteractive ( ) ;
747757
748758 return {
749759 abi : ( abiFromApi || abiFromFile ) ! ,
@@ -761,7 +771,6 @@ async function processInitForm(
761771 cleanup : spkgCleanup ,
762772 } ;
763773 } catch ( e ) {
764- console . error ( e ) ;
765774 this . error ( e , { exit : 1 } ) ;
766775 }
767776}
0 commit comments