英文:
Do we have some shell tools like makefile that supports nested subcommands?
问题
例如,我只需要像下面这样编辑配置文件:
clean:
rpc:
rm -rf ./rpc
api
rm -rf ./api
运行:
> make clean rpc
然而,make
不支持嵌套子命令。
一个不错的选择是https://github.com/spf13/cobra
,它支持子命令
和命令别名
... 但它是用于golang,而不是shell。
我想知道在shell中是否有cobra
?
英文:
For example, I just need to edit the config file like the following:
clean:
rpc:
rm -rf ./rpc
api
rm -rf ./api
run:
> make clean rpc
However, make
don't support nested subcommands.
A good choice is https://github.com/spf13/cobra
, which supports subcommands
and command alias
... But it is used in golang, not shell.
I wonder do we havecobra
in shell?
答案1
得分: 0
我想知道我们的shell中是否有cobra。
我找到了一个链接,这是链接:https://taskfile.dev/#/
以下是示例:
Taskfile.yml
version: "3"
tasks:
clean:rpc:
desc: 清理RPC
cmds:
- rm -rf ./rpc
clean:api:
desc: 清理API
cmds:
- rm -rf ./api
要查看可用命令:task --list
要执行命令:task clean:api
或 task clean:rpc
英文:
I wonder do we have cobra in shell?
I found 1,<br/>
This is the link: https://taskfile.dev/#/
Below is the example:
Taskfile.yml
version: "3"
tasks:
clean:rpc:
desc: Clean RPC
cmds:
- rm -rf ./rpc
clean:api:
desc: Clean API
cmds:
- rm -rf ./api
To view available commands: task --list
<br/>
To exec command: task clean:api
or task clean:rpc
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论