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

Is there an "official" way to call a command from within a command? #72

Closed
abh1kg opened this issue May 23, 2021 · 1 comment
Closed
Labels
question Further information is requested

Comments

@abh1kg
Copy link

abh1kg commented May 23, 2021

I know I can probably do this by invoking the generated function but I am looking for some documentation-based guidance (if possible) on this scenario. I have two commands, let's say, cli dothis and cli dothat.
I want to call cli dothat from within the implementation for cli dothis. Can this be done without knowing the internals of the generated bashly file?

@DannyBen
Copy link
Owner

DannyBen commented May 23, 2021

Well, I don't know about "official way" but I can recommend that you simply avoid this problem.

Instead of calling one command from another command, do a bash function (inside the lib directory) that will be called by both commands.

You can see for example the lib folder in rush or in alf.

In any case, I would not recommend calling the functions generated by bashly, as these are not guaranteed to stay the same.

P.S.: Run bashly add lib to get a sample template.

@DannyBen DannyBen added the question Further information is requested label May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants