@@ -9,25 +9,25 @@ import (
9
9
10
10
var CmdQuestion = & base.Command {
11
11
Run : runQuestion ,
12
- UsageLine : "question (QuestionFrontendId )" ,
13
- Short : "build problem description file" ,
14
- Long : "build problem's go,README.md file." ,
12
+ UsageLine : "question (QuestionId )" ,
13
+ Short : "build problem solution file" ,
14
+ Long : "build problem's description,solution file." ,
15
15
}
16
16
17
17
func runQuestion (cmd * base.Command , args []string ) {
18
18
if len (args ) != 1 {
19
19
cmd .Usage ()
20
20
}
21
- questionId , err := strconv .Atoi (args [0 ])
22
- base . CheckErr ( err )
23
- problems := leetcode . ProblemsAll ()
24
- for _ , problem := range problems . StatStatusPairs {
25
- if problem .Stat .FrontendQuestionId == questionId {
26
- titleSlug := problem . Stat . QuestionTitleSlug
27
- question := leetcode . QuestionData ( titleSlug ). Data . Question
28
- question .SaveContent ()
29
- question . SaveCodeSnippet ()
30
- break
21
+ if questionId , err := strconv .Atoi (args [0 ]); err == nil {
22
+ problems := leetcode . ProblemsAll ( )
23
+ for _ , problem := range problems . StatStatusPairs {
24
+ if problem . Stat . FrontendQuestionId == questionId {
25
+ titleSlug := problem .Stat .QuestionTitleSlug
26
+ question := leetcode . QuestionData ( titleSlug ). Data . Question
27
+ question . SaveContent ()
28
+ question .SaveCodeSnippet ()
29
+ break
30
+ }
31
31
}
32
32
}
33
33
}
0 commit comments