You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I'm trying to create a cli app (interactive) that uses commands to perform tasks. For each task I create a command instance.
For example I provide a get command for user to use.
const getCmd = program.command('get')
.description('get information from a endpoint')
.argument('<path>', 'path of the component, [endpointName/componentType]')
.argument('[compName]', 'name of the component', '')
.option('-a, --attributes [attributeNames...]', 'get attributes from component', '')
.action(async (path, compName, options, cmd) => {
...
});
In the interactive shell (I use readline lib) if user input get args opts the getCmd will called getCmd.parseAsync(allargs [])
then after the command is executed, the shell waiting for next command, if user inputs the same get command but with some options removed, when it calls the getCmd.parseAsync(allargs) again I found some of the options from the first execution remains.
So basically I assume each time I have to create a new instance of the get command. I wonder if there is a way to reset the command for reuse?
The text was updated successfully, but these errors were encountered:
Hi I'm trying to create a cli app (interactive) that uses commands to perform tasks. For each task I create a command instance.
For example I provide a
get
command for user to use.In the interactive shell (I use readline lib) if user input
get args opts
the getCmd will calledgetCmd.parseAsync(allargs [])
then after the command is executed, the shell waiting for next command, if user inputs the same get command but with some options removed, when it calls the
getCmd.parseAsync(allargs)
again I found some of the options from the first execution remains.So basically I assume each time I have to create a new instance of the
get
command. I wonder if there is a way toreset
the command for reuse?The text was updated successfully, but these errors were encountered: