mirror of
https://github.com/spf13/cobra
synced 2025-05-06 13:27:26 +00:00
Help text cobra add --parent with example enhanced
This commit is contained in:
parent
67fc4837d2
commit
3f6e4c4e81
1 changed files with 2 additions and 1 deletions
|
@ -24,7 +24,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
addCmd.Flags().StringVarP(&packageName, "package", "t", "", "target package name (e.g. github.com/spf13/hugo)")
|
addCmd.Flags().StringVarP(&packageName, "package", "t", "", "target package name (e.g. github.com/spf13/hugo)")
|
||||||
addCmd.Flags().StringVarP(&parentName, "parent", "p", "rootCmd", "variable name of parent command for this command")
|
addCmd.Flags().StringVarP(&parentName, "parent", "p", "rootCmd", "variable name of parent command for this command (e.g. xyCmd)")
|
||||||
}
|
}
|
||||||
|
|
||||||
var packageName, parentName string
|
var packageName, parentName string
|
||||||
|
@ -59,6 +59,7 @@ Example: cobra add server -> resulting in a new cmd/server.go`,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdName := validateCmdName(args[0])
|
cmdName := validateCmdName(args[0])
|
||||||
|
//! Hier ein cmdNameConstructor
|
||||||
cmdPath := filepath.Join(project.CmdPath(), cmdName+".go")
|
cmdPath := filepath.Join(project.CmdPath(), cmdName+".go")
|
||||||
createCmdFile(project.License(), cmdPath, cmdName)
|
createCmdFile(project.License(), cmdPath, cmdName)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue