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

Run command automatically on startup #134

Open
shounakdatta opened this issue Apr 10, 2020 · 0 comments
Open

Run command automatically on startup #134

shounakdatta opened this issue Apr 10, 2020 · 0 comments

Comments

@shounakdatta
Copy link

shounakdatta commented Apr 10, 2020

I am trying to make a CLI app that works similarly to npm. I am using cobra to register the individual commands, and on certain commands, I want to launch an interactive shell with ishell and run a specific command on startup of the shell.

EDIT: If not a startup command, is there a way to programatically run commands?

Example:
Say npm is my CLI app and init is the command that fires up an ishell instance.

The above is implemented with cobra but my understanding is cobra cannot use standard input, hence the use of ishell.

But upon typing npm init, I don't want to run another command in the shell, but automatically prompt for standard input. This can be done by having ishell run a command as soon as shell.Run() is called. Is this possible?

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

1 participant