-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Implement 'all' Command for Sequential Execution of All Commands #435
Comments
Yes it is possible, but probably not in the way you think. Implementing such a solution in a generic way, would be problematic. There are arguments, and flags, and possibly other requirements for each of your commands - so what will the So - you have several options: Option 1: Call your other commands by re-running the CLIYour # src/all_command.sh
./cli build --force
./cli deploy eu-west
# or $0
$0 build
$0 deploy eu-west In real life, your script will probably be installed in the PATH ( Option 2: Use functionsIf you are familiar with Model-View-Controller architecture, treat the code that you write in the For example: The basic commands # src/build_comnmand.sh
build_project
# src/deploy_command.sh
region=${args[region]}
deploy_project "$region" Functions # src/lib/build_project.sh
build_project() {
echo "BUILDING..."
}
# src/lib/deploy_project.sh
deploy_project() {
region="$1"
echo "DEPLOYING TO $region..."
} The # src/all_command.sh
build_project
deploy_project "eu"
# or, if your `all` command also has arguments
deploy_project "${args[region]}" Does this help? |
Excellent! Thank you for your quick and detailed response @DannyBen. |
My pleasure. Enjoy, and feel free to open an issue or a discussion if you have any problems or questions. |
Description
Hello,
I have 3 commands named
pod
,service
,pvc
. I want to add a fourth command calledall
. When I executeall
I want the other 3 commands to be executed in order.Is that possible?
The text was updated successfully, but these errors were encountered: