diff --git a/command/issue.go b/command/issue.go index 4fc937a1e..66e145672 100644 --- a/command/issue.go +++ b/command/issue.go @@ -21,17 +21,17 @@ func init() { "Supply a title. Will prompt for one otherwise.") issueCreateCmd.Flags().StringP("body", "b", "", "Supply a body. Will prompt for one otherwise.") - issueCreateCmd.Flags().BoolP("web", "w", false, "open the web browser to create an issue") + issueCreateCmd.Flags().BoolP("web", "w", false, "Open the web browser to create an issue") issueListCmd := &cobra.Command{ Use: "list", Short: "List and filter issues in this repository", RunE: issueList, } - issueListCmd.Flags().StringP("assignee", "a", "", "filter by assignee") - issueListCmd.Flags().StringSliceP("label", "l", nil, "filter by label") - issueListCmd.Flags().StringP("state", "s", "", "filter by state (open|closed|all)") - issueListCmd.Flags().IntP("limit", "L", 30, "maximum number of issues to fetch") + issueListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee") + issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label") + issueListCmd.Flags().StringP("state", "s", "", "Filter by state (open|closed|all)") + issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch") issueCmd.AddCommand((issueListCmd)) } diff --git a/command/pr.go b/command/pr.go index 5b3a4a16a..5d45de54b 100644 --- a/command/pr.go +++ b/command/pr.go @@ -20,10 +20,10 @@ func init() { prCmd.AddCommand(prStatusCmd) prCmd.AddCommand(prViewCmd) - prListCmd.Flags().IntP("limit", "L", 30, "maximum number of items to fetch") - prListCmd.Flags().StringP("state", "s", "open", "filter by state") - prListCmd.Flags().StringP("base", "b", "", "filter by base branch") - prListCmd.Flags().StringArrayP("label", "l", nil, "filter by label") + prListCmd.Flags().IntP("limit", "L", 30, "Maximum number of items to fetch") + prListCmd.Flags().StringP("state", "s", "open", "Filter by state") + prListCmd.Flags().StringP("base", "B", "", "Filter by base branch") + prListCmd.Flags().StringArrayP("label", "l", nil, "Filter by label") } var prCmd = &cobra.Command{ diff --git a/command/root.go b/command/root.go index e8764c44b..87f11a241 100644 --- a/command/root.go +++ b/command/root.go @@ -19,10 +19,11 @@ var BuildDate = "YYYY-MM-DD" func init() { RootCmd.Version = fmt.Sprintf("%s (%s)", strings.TrimPrefix(Version, "v"), BuildDate) - RootCmd.AddCommand(versionCmd) + RootCmd.AddCommand(versionCmd) - RootCmd.PersistentFlags().StringP("repo", "R", "", "current GitHub repository") - RootCmd.PersistentFlags().StringP("current-branch", "B", "", "current git branch") + RootCmd.PersistentFlags().StringP("repo", "R", "", "Current GitHub repository") + RootCmd.PersistentFlags().Bool("help", false, "Show help for command") + RootCmd.Flags().Bool("version", false, "Print gh version") // TODO: // RootCmd.PersistentFlags().BoolP("verbose", "V", false, "enable verbose output") @@ -67,9 +68,7 @@ func contextForCommand(cmd *cobra.Command) context.Context { ctx := initContext() if repo, err := cmd.Flags().GetString("repo"); err == nil && repo != "" { ctx.SetBaseRepo(repo) - } - if branch, err := cmd.Flags().GetString("current-branch"); err == nil && branch != "" { - ctx.SetBranch(branch) + ctx.SetBranch("master") } return ctx }