diff --git a/pkg/cmd/repo/fork/fork.go b/pkg/cmd/repo/fork/fork.go index 62063f102..c3b559c97 100644 --- a/pkg/cmd/repo/fork/fork.go +++ b/pkg/cmd/repo/fork/fork.go @@ -7,6 +7,7 @@ import ( "strings" "time" + "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/context" "github.com/cli/cli/v2/git" @@ -61,21 +62,23 @@ func NewCmdFork(f *cmdutil.Factory, runF func(*ForkOptions) error) *cobra.Comman Use: "fork [] [-- ...]", Args: func(cmd *cobra.Command, args []string) error { if cmd.ArgsLenAtDash() == 0 && len(args[1:]) > 0 { - return cmdutil.FlagErrorf("repository argument required when passing 'git clone' flags") + return cmdutil.FlagErrorf("repository argument required when passing git clone flags") } return nil }, Short: "Create a fork of a repository", - Long: `Create a fork of a repository. + Long: heredoc.Docf(` + Create a fork of a repository. -With no argument, creates a fork of the current repository. Otherwise, forks -the specified repository. + With no argument, creates a fork of the current repository. Otherwise, forks + the specified repository. -By default, the new fork is set to be your 'origin' remote and any existing -origin remote is renamed to 'upstream'. To alter this behavior, you can set -a name for the new fork's remote with --remote-name. + By default, the new fork is set to be your "origin" remote and any existing + origin remote is renamed to "upstream". To alter this behavior, you can set + a name for the new fork's remote with %[1]s--remote-name%[1]s. -Additional 'git clone' flags can be passed in by listing them after '--'.`, + Additional git clone flags can be passed after %[1]s--%[1]s. + `, "`"), RunE: func(cmd *cobra.Command, args []string) error { promptOk := opts.IO.CanPrompt() if len(args) > 0 { @@ -109,14 +112,14 @@ Additional 'git clone' flags can be passed in by listing them after '--'.`, if err == pflag.ErrHelp { return err } - return cmdutil.FlagErrorf("%w\nSeparate git clone flags with '--'.", err) + return cmdutil.FlagErrorf("%w\nSeparate git clone flags with `--`.", err) }) - cmd.Flags().BoolVar(&opts.Clone, "clone", false, "Clone the fork {true|false}") - cmd.Flags().BoolVar(&opts.Remote, "remote", false, "Add remote for fork {true|false}") - cmd.Flags().StringVar(&opts.RemoteName, "remote-name", defaultRemoteName, "Specify a name for a fork's new remote.") + cmd.Flags().BoolVar(&opts.Clone, "clone", false, "Clone the fork") + cmd.Flags().BoolVar(&opts.Remote, "remote", false, "Add a git remote for the fork") + cmd.Flags().StringVar(&opts.RemoteName, "remote-name", defaultRemoteName, "Specify the name for the new remote") cmd.Flags().StringVar(&opts.Organization, "org", "", "Create the fork in an organization") - cmd.Flags().StringVar(&opts.ForkName, "fork-name", "", "Specify a name for the forked repo") + cmd.Flags().StringVar(&opts.ForkName, "fork-name", "", "Rename the forked repository") return cmd } diff --git a/pkg/cmd/repo/fork/fork_test.go b/pkg/cmd/repo/fork/fork_test.go index 69e73a395..749bf7e61 100644 --- a/pkg/cmd/repo/fork/fork_test.go +++ b/pkg/cmd/repo/fork/fork_test.go @@ -45,7 +45,7 @@ func TestNewCmdFork(t *testing.T) { name: "git args without repo", cli: "-- --foo bar", wantErr: true, - errMsg: "repository argument required when passing 'git clone' flags", + errMsg: "repository argument required when passing git clone flags", }, { name: "repo", @@ -130,7 +130,7 @@ func TestNewCmdFork(t *testing.T) { name: "git flags in wrong place", cli: "--depth 1 OWNER/REPO", wantErr: true, - errMsg: "unknown flag: --depth\nSeparate git clone flags with '--'.", + errMsg: "unknown flag: --depth\nSeparate git clone flags with `--`.", }, { name: "with fork name",