feat(cli): 根命令支持 --version(复用 i18n version 文案)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
laurencewannamaker 2026-07-05 22:38:46 +00:00
parent c09645da62
commit f402dce051
1 changed files with 2 additions and 0 deletions

View File

@ -44,9 +44,11 @@ func NewRootCmd(opts RootOptions, tr *i18n.Translator) (*cobra.Command, error) {
Use: "gitlink-cli",
Short: tr.T("cmd.root.short"),
Long: tr.T("cmd.root.long"),
Version: version,
SilenceUsage: true,
SilenceErrors: true,
}
rootCmd.SetVersionTemplate(tr.Tf("output.version", i18n.Args{"version": version}) + "\n")
rootCmd.PersistentFlags().StringVar(&cmdutil.Owner, "owner", "", tr.T("flag.owner"))
rootCmd.PersistentFlags().StringVar(&cmdutil.Repo, "repo", "", tr.T("flag.repo"))