Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you use it with commands? #48

Open
JoshMcCullough opened this issue May 13, 2022 · 4 comments
Open

How do you use it with commands? #48

JoshMcCullough opened this issue May 13, 2022 · 4 comments

Comments

@JoshMcCullough
Copy link

JoshMcCullough commented May 13, 2022

I don't see how to use this package with commands. E.g. ...

yargsInteractive()
    .command('do-it', 'Does things.', o => o
      .options(myOptions))
    .strict()
    .demandCommand()
    .help()
    .argv;

I can only call .interactive(...) and pass in options directly from the yargsInteractive() return. I can't seem to configure an interactive command.

@yfwz100
Copy link

yfwz100 commented Jun 18, 2022

I am looking for command support too...

@nanovazquez
Copy link
Owner

Hey @JoshMcCullough and @yfwz100 . Can you provide the use cases you are looking for with more detail? If you want to use command, why not use yargs directly?

The purpose of the library is to provide support for interactivity commands, using a yargs fashion, but also add the ability to pass values to these commands when the interactivity is not needed (i.e. in CI environments).

@JoshMcCullough
Copy link
Author

The use case is myapp do-it with an arg, e.g. name. When name is not provided as an argument on the command line, then we'd like yargs-interactive to prompt for it. Currently you can only do interactive stuff without commands.

@walterra
Copy link

I came here looking for the same and thought it was somehow supported since the examples use .usage('$0 <command> [args]') which would hint at "command" support. If that's not the case and not planned maybe these description should be updated to say just .usage('$0 [args]')? Still agree with previous posters that the use case would be to have a main script with several commands where each command would support an interactive mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants