File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
packages/cli/src/commands Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -422,14 +422,22 @@ async function processInitForm(
422422 const networkToChoice = ( n : Network ) => ( {
423423 name : n . id ,
424424 value : `${ n . id } :${ n . shortName } :${ n . fullName } ` . toLowerCase ( ) ,
425- hint : n . id ,
425+ hint : `· ${ n . id } ` ,
426426 message : n . fullName ,
427427 } ) ;
428428
429429 const formatChoices = ( choices : ReturnType < typeof networkToChoice > [ ] ) => {
430430 const shown = choices . slice ( 0 , 20 ) ;
431431 const remaining = networks . length - shown . length ;
432432 if ( remaining == 0 ) return shown ;
433+ if ( shown . length === choices . length ) {
434+ shown . push ( {
435+ name : '--other--' ,
436+ value : '' ,
437+ hint : '· other network not on the list' ,
438+ message : `Other` ,
439+ } ) ;
440+ }
433441 return [
434442 ...shown ,
435443 {
@@ -477,7 +485,12 @@ async function processInitForm(
477485 . map ( networkToChoice )
478486 . filter ( ( { value } ) => ( value ?? '' ) . includes ( input . toLowerCase ( ) ) ) ,
479487 ) ,
480- validate : value => ( networks . find ( n => n . id === value ) ? true : 'Pick a network' ) ,
488+ validate : value => {
489+ if ( value === '--other--' ) {
490+ return 'To add a network refer to https://github.com/graphprotocol/networks-registry' ;
491+ }
492+ return networks . find ( n => n . id === value ) ? true : 'Pick a network' ;
493+ } ,
481494 result : value => {
482495 initDebugger . extend ( 'processInitForm' ) ( 'networkId: %O' , value ) ;
483496 network = networks . find ( n => n . id === value ) ! ;
You can’t perform that action at this time.
0 commit comments