问题标签 [go-cobra]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
59 浏览

go - 这个命令做什么'GOFLAGS = -mod = mod'?

我正在尝试制作一个 Taskfile.yml 文件来构建 Go 应用程序,但在构建 main.go 之前我不太了解“GOFLAGS=-mod=mod”命令的需要。

参考:https ://dev.to/aurelievache/learning-go-by-examples-part-3-create-a-cli-app-in-go-1h43

0 投票
1 回答
23 浏览

go - Link another Golang Cobra CLI to current Golang Cobra CLI

I am working on a new Golang Cobra CLI, which handles several commands. I later on found out that there is already an existing Golang Cobra CLI that handles some commands that I will be covering in the new CLI, but not all. In other words, my new CLI cover all commands of the existing CLI with some extra commands.

Is it possible for us to link the existing CLI into the new CLI?

Note: I am not sure whether "link" is the best word to describe what I am interested to do. In case this is already answered before on SA, feel free to mark this as duplicate.

0 投票
0 回答
17 浏览

go - 区分 Cobra 帮助消息中的必需标志和可选标志

我创建了一个命令,如下所示:

现在,当运行命令时,--help我会收到如下帮助消息。

我想将标志分组为持久(必需)和非持久(不需要),如下所示

我知道我可以使用该SetHelpTemplate()函数并设置我自己的字符串,该字符串将在实例化帮助时显示,我想知道是否有本地 cobra 库或 pflag 方法来定义不同类别的标志。