WIP: start on passing through help when appropriate
parent
2ae5135f3a
commit
0353e2d704
7
main.go
7
main.go
|
@ -18,11 +18,17 @@ const binroot = "/town/commands"
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "town",
|
Use: "town",
|
||||||
Short: "Run commands unique to tilde.town",
|
Short: "Run commands unique to tilde.town",
|
||||||
|
DisableFlagParsing: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.Flags().BoolP("help", "h", false, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
var adminCmd = &cobra.Command{
|
var adminCmd = &cobra.Command{
|
||||||
Use: "admin",
|
Use: "admin",
|
||||||
Short: "Run administrative commands",
|
Short: "Run administrative commands",
|
||||||
|
DisableFlagParsing: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func isAdmin() (bool, error) {
|
func isAdmin() (bool, error) {
|
||||||
|
@ -134,6 +140,7 @@ func execWrapper(executablePath string) func(*cobra.Command, []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cli() int {
|
func cli() int {
|
||||||
|
rootCommand.PersistentFlags().BoolFlagP("help", "h", false)
|
||||||
err := parseCommands(rootCmd, "core")
|
err := parseCommands(rootCmd, "core")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to parse core commands: %s", err)
|
fmt.Fprintf(os.Stderr, "failed to parse core commands: %s", err)
|
||||||
|
|
Reference in New Issue