Skip to content

Commit af58d23

Browse files
author
Shuo
authored
Merge pull request #635 from openset/develop
Remove: Exit
2 parents ed4d353 + 071e4b8 commit af58d23

File tree

22 files changed

+28
-14
lines changed

22 files changed

+28
-14
lines changed

internal/base/base.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ func (c *Command) Name() string {
3838
func (c *Command) Usage() {
3939
fmt.Printf("usage: %s %s\n\n", CmdName, c.UsageLine)
4040
fmt.Printf("Run '%s help %s' for details.\n", CmdName, c.Name())
41-
Exit()
4241
}
4342

4443
func (c *Command) UsageHelp() {
4544
fmt.Printf("usage: %s %s\n\n", CmdName, c.UsageLine)
4645
fmt.Println(c.Long)
47-
Exit()
4846
}
4947

5048
func Usage() {
@@ -58,7 +56,6 @@ func Usage() {
5856
}
5957
}
6058
fmt.Printf("\nUse \"%s help <command>\" for more information about a command.\n", CmdName)
61-
Exit()
6259
}
6360

6461
func FilePutContents(filename string, data []byte) []byte {
@@ -99,10 +96,6 @@ func CheckErr(err error) {
9996
}
10097
}
10198

102-
func Exit() {
103-
os.Exit(0)
104-
}
105-
10699
func AuthInfo(cmd string) string {
107100
format := "<!--|This file generated by command(leetcode %s); DO NOT EDIT.%s|-->\n"
108101
format += "<!--+----------------------------------------------------------------------+-->\n"

internal/build/build.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var CmdBuild = &base.Command{
2323
func runBuild(cmd *base.Command, args []string) {
2424
if len(args) != 0 {
2525
cmd.Usage()
26+
return
2627
}
2728
target := map[string][]string{
2829
"darwin": {"amd64"},

internal/clean/clean.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var CmdClean = &base.Command{
1515
func runClean(cmd *base.Command, args []string) {
1616
if len(args) != 0 {
1717
cmd.Usage()
18+
return
1819
}
1920
leetcode.Clean()
2021
}

internal/description/description.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var CmdDescription = &base.Command{
1818
func runDescription(cmd *base.Command, args []string) {
1919
if len(args) != 0 {
2020
cmd.Usage()
21+
return
2122
}
2223
var wg sync.WaitGroup
2324
limit := 1 << 7

internal/help/help.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var CmdHelp = &base.Command{
1616
func runHelp(cmd *base.Command, args []string) {
1717
if len(args) < 1 {
1818
base.Usage()
19+
return
1920
}
2021
cmdName := args[0]
2122
for _, cmd := range base.Commands {

internal/helper/helper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var CmdHelper = &base.Command{
1717
func runHelper(cmd *base.Command, args []string) {
1818
if len(args) != 0 {
1919
cmd.Usage()
20+
return
2021
}
2122
var buf bytes.Buffer
2223
buf.WriteString(base.AuthInfo("helper"))

internal/open/open.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var CmdOpen = &base.Command{
1818
func runOpen(cmd *base.Command, args []string) {
1919
if len(args) != 1 {
2020
cmd.Usage()
21+
return
2122
}
2223
questionId, err := strconv.Atoi(args[0])
2324
base.CheckErr(err)

internal/page/page.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var CmdPage = &base.Command{
1515
func runPage(cmd *base.Command, args []string) {
1616
if len(args) != 0 {
1717
cmd.Usage()
18+
return
1819
}
1920
readme.CmdReadme.Run(readme.CmdReadme, []string{"page"})
2021
}

internal/post/post.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var CmdPost = &base.Command{
2424
func runPost(cmd *base.Command, args []string) {
2525
if len(args) != 0 {
2626
cmd.Usage()
27+
return
2728
}
2829
formatFilename := "%s-%s.md"
2930
formatTopicTag := " [[%s](https://github.com/openset/leetcode/tree/master/tag/%s/README.md)]\n"

internal/question/question.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var CmdQuestion = &base.Command{
1818
func runQuestion(cmd *base.Command, args []string) {
1919
if len(args) != 1 {
2020
cmd.Usage()
21+
return
2122
}
2223
if questionId, err := strconv.Atoi(args[0]); err == nil {
2324
problems := leetcode.ProblemsAll()

0 commit comments

Comments
 (0)