Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
//term.green( "\n'%s' '%s' '%s' '%s'\n" , typedImplicitFullPath , typedDir , typedFile , parentDirPath ) ;
try {
files = await fsKit.readdirAsync( parentDirPath , { slash: true , directories: true , files: ! onlyDir } ) ;
if ( files.length ) { files.push( '../' ) ; }
}
catch ( error ) {
return prefix + typedPath ;
}
//console.log( files ) ;
if ( ! Array.isArray( files ) || ! files.length ) { return prefix + typedPath ; }
completion = termkit.autoComplete( files , typedFile , true ) ;
// force inputField() to prefix that *AFTER* singleLineMenu()
if ( Array.isArray( completion ) ) { completion.prefix = prefix + typedDir ; }
else { completion = prefix + typedDir + completion ; }
return completion ;
} ;
}
else if ( start.length >= 7 && start.slice( 0 , 7 ) === 'http://' ) {
typedPath = start.slice( 7 ) ;
return autoCompletePath( query , start , typedPath , 'http://' , false ) ;
}
else if ( start.length >= 8 && start.slice( 0 , 8 ) === 'https://' ) {
typedPath = start.slice( 8 ) ;
return autoCompletePath( query , start , typedPath , 'https://' , false ) ;
}
else if ( start.length >= 5 && start.slice( 0 , 5 ) === 'ws://' ) {
typedPath = start.slice( 5 ) ;
return autoCompletePath( query , start , typedPath , 'ws://' , false ) ;
}
// Use the default terminal-kit auto-completer with the client array of possibilities
return termkit.autoComplete( this.clientAutoCompleteArray , start , true ) ;
} ;
}
else if ( start.startsWith( 'http://' ) ) {
typedPath = start.slice( 7 ) ;
return this.autoCompletePath( start , typedPath , 'http://' , false ) ;
}
else if ( start.startsWith( 'https://' ) ) {
typedPath = start.slice( 8 ) ;
return this.autoCompletePath( start , typedPath , 'https://' , false ) ;
}
else if ( start.startsWith( 'ws://' ) ) {
typedPath = start.slice( 5 ) ;
return this.autoCompletePath( start , typedPath , 'ws://' , false ) ;
}
// Use the default terminal-kit auto-completer with the client array of possibilities
return termkit.autoComplete( constants.clientAutoCompleteArray , start , true ) ;
} ;
fs.readdir(__dirname, (error, files) => {
callback(undefined, ac(files, inputString, true));
});
};
if ( typedPathArray[ typedPathArray.length - 1 ] === '' ) { typedPathArray.pop() ; }
}
prefix += typedDir ;
node = pathArray.length ? tree.path.get( pathCompletion , pathArray ) : pathCompletion ;
//console.log( '\n\nnode:' , node , pathArray ) ;
if ( ! node || typeof node !== 'object' ) { return start ; }
for ( key in node ) {
if ( node[ key ] && typeof node[ key ] === 'object' ) { completion.push( key + '/' ) ; }
else { completion.push( key ) ; }
}
completion = termkit.autoComplete( completion , lastTypedPart , true ) ;
if ( ! Array.isArray( completion ) ) { return prefix + completion ; }
completion.sort( naturalSort ) ;
completion.prefix = prefix ;
return completion ;
}
if ( typedPathArray[ typedPathArray.length - 1 ] === '' ) { typedPathArray.pop() ; }
}
prefix += typedDir ;
node = pathArray.length ? tree.path.get( this.pathCompletion , pathArray ) : this.pathCompletion ;
//console.log( '\n\nnode:' , node , pathArray ) ;
if ( ! node || typeof node !== 'object' ) { return start ; }
for ( key in node ) {
if ( node[ key ] && typeof node[ key ] === 'object' ) { completion.push( key + '/' ) ; }
else { completion.push( key ) ; }
}
completion = termkit.autoComplete( completion , lastTypedPart , true ) ;
if ( ! Array.isArray( completion ) ) { return prefix + completion ; }
completion.sort( naturalSort ) ;
completion.prefix = prefix ;
return completion ;
} ;
fs.readdir( __dirname , function( error , files ) {
callback( undefined , termkit.autoComplete( files , inputString , true , prefix ) ) ;
} ) ;
} ;
fs.readdir( __dirname , function( error , files ) {
callback( undefined , termkit.autoComplete( files , inputString , true ) ) ;
} ) ;
} ;