Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d406e87

Browse files
author
Sandy
authored
Merge pull request #26 from openset/develop
Add: UsageHelp
2 parents dc59511 + db8dd3c commit d406e87

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎internal/base/base.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ func (c *Command) Usage() {
3131
Exit()
3232
}
3333

34+
func (c *Command) UsageHelp() {
35+
fmt.Printf("usage: %s %s\n", CmdName, c.UsageLine)
36+
fmt.Println(c.Long)
37+
Exit()
38+
}
39+
3440
func Usage() {
3541
fmt.Printf("%s is a tool for managing leetcode source code.\n\n", CmdName)
3642
fmt.Println("Usage:")

‎internal/help/help.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func runHelp(cmd *base.Command, args []string) {
2020
cmdName := args[0]
2121
for _, cmd := range base.Commands {
2222
if cmd.Name() == cmdName {
23-
cmd.Usage()
23+
cmd.UsageHelp()
2424
}
2525
}
2626
fmt.Printf("%s help %s: unknown help topic.\n", base.CmdName, cmdName)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /