Modify documentation if called from issue or pr
This commit is contained in:
parent
364dd38bc0
commit
e019ff9f02
3 changed files with 16 additions and 16 deletions
|
|
@ -42,10 +42,10 @@ func NewCmdIssue(f *cmdutil.Factory) *cobra.Command {
|
|||
cmd.AddCommand(cmdClose.NewCmdClose(f, nil))
|
||||
cmd.AddCommand(cmdCreate.NewCmdCreate(f, nil))
|
||||
cmd.AddCommand(cmdList.NewCmdList(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdLock(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdLock(f, cmd.Name()))
|
||||
cmd.AddCommand(cmdReopen.NewCmdReopen(f, nil))
|
||||
cmd.AddCommand(cmdStatus.NewCmdStatus(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdUnlock(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdUnlock(f, cmd.Name()))
|
||||
cmd.AddCommand(cmdView.NewCmdView(f, nil))
|
||||
cmd.AddCommand(cmdComment.NewCmdComment(f, nil))
|
||||
cmd.AddCommand(cmdDelete.NewCmdDelete(f, nil))
|
||||
|
|
|
|||
|
|
@ -98,15 +98,19 @@ func (opts *LockOptions) setCommonOptions(f *cmdutil.Factory, cmd *cobra.Command
|
|||
|
||||
}
|
||||
|
||||
func NewCmdLock(f *cmdutil.Factory, runF func(*LockOptions) error) *cobra.Command {
|
||||
func NewCmdLock(f *cmdutil.Factory, parentName string) *cobra.Command {
|
||||
|
||||
opts := &LockOptions{
|
||||
ParentCmd: parentName,
|
||||
PadlockState: Lock,
|
||||
}
|
||||
|
||||
c := cmds[opts.ParentCmd]
|
||||
short := fmt.Sprintf("Lock %s conversation", strings.ToLower(c.FullName))
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "lock {<number> | <url>}",
|
||||
Short: "Lock a conversation",
|
||||
Short: short,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
|
|
@ -123,11 +127,6 @@ func NewCmdLock(f *cmdutil.Factory, runF func(*LockOptions) error) *cobra.Comman
|
|||
}
|
||||
}
|
||||
|
||||
opts.setCommonOptions(f, cmd, args)
|
||||
|
||||
if runF != nil {
|
||||
return runF(opts)
|
||||
}
|
||||
return padlock(opts)
|
||||
},
|
||||
}
|
||||
|
|
@ -138,23 +137,24 @@ func NewCmdLock(f *cmdutil.Factory, runF func(*LockOptions) error) *cobra.Comman
|
|||
return cmd
|
||||
}
|
||||
|
||||
func NewCmdUnlock(f *cmdutil.Factory, runF func(*LockOptions) error) *cobra.Command {
|
||||
func NewCmdUnlock(f *cmdutil.Factory, parentName string) *cobra.Command {
|
||||
|
||||
opts := &LockOptions{
|
||||
ParentCmd: parentName,
|
||||
PadlockState: Unlock,
|
||||
}
|
||||
|
||||
c := cmds[opts.ParentCmd]
|
||||
short := fmt.Sprintf("Unlock %s conversation", strings.ToLower(c.FullName))
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "unlock {<number> | <url>}",
|
||||
Short: "Unlock a conversation",
|
||||
Short: short,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
opts.setCommonOptions(f, cmd, args)
|
||||
|
||||
if runF != nil {
|
||||
return runF(opts)
|
||||
}
|
||||
return padlock(opts)
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ func NewCmdPR(f *cmdutil.Factory) *cobra.Command {
|
|||
cmd.AddCommand(cmdCreate.NewCmdCreate(f, nil))
|
||||
cmd.AddCommand(cmdDiff.NewCmdDiff(f, nil))
|
||||
cmd.AddCommand(cmdList.NewCmdList(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdLock(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdLock(f, cmd.Name()))
|
||||
cmd.AddCommand(cmdMerge.NewCmdMerge(f, nil))
|
||||
cmd.AddCommand(cmdReady.NewCmdReady(f, nil))
|
||||
cmd.AddCommand(cmdReopen.NewCmdReopen(f, nil))
|
||||
cmd.AddCommand(cmdReview.NewCmdReview(f, nil))
|
||||
cmd.AddCommand(cmdStatus.NewCmdStatus(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdUnlock(f, nil))
|
||||
cmd.AddCommand(cmdLock.NewCmdUnlock(f, cmd.Name()))
|
||||
cmd.AddCommand(cmdView.NewCmdView(f, nil))
|
||||
cmd.AddCommand(cmdChecks.NewCmdChecks(f, nil))
|
||||
cmd.AddCommand(cmdComment.NewCmdComment(f, nil))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue