@@ -60,10 +60,10 @@ func root(args []string) error {
6060 } else {
6161 qn , err = strconv .Atoi (q )
6262 if err != nil {
63- return fmt .Errorf ("the number of questions should be a valid integer " )
63+ return fmt .Errorf ("-q should be within [min=1, max=10], please check your env " )
6464 }
6565 if qn < 1 || qn > 10 {
66- qn = 1
66+ return fmt . Errorf ( "-q should be within [min=1, max=10], please check your env" )
6767 }
6868 }
6969 a , set := os .LookupEnv ("GOSO_ANSWERS" )
@@ -72,17 +72,17 @@ func root(args []string) error {
7272 } else {
7373 an , err = strconv .Atoi (a )
7474 if err != nil {
75- return fmt .Errorf ("the number of answers should be a valid integer " )
75+ return fmt .Errorf ("-a should be within [min=1, max=10], please check your env " )
7676 }
7777 if an < 1 || an > 10 {
78- an = 1
78+ return fmt . Errorf ( "-a should be within [min=1, max=10], please check your env" )
7979 }
8080 }
8181 flags := flag .NewFlagSet (app , flag .ExitOnError )
8282 flags .StringVar (& conf .Lexer , "l" , lex , "The name of Chroma lexer. See https://github.com/alecthomas/chroma/tree/master/lexers/embedded" )
8383 flags .StringVar (& conf .Style , "s" , style , "The name of Chroma style. See https://xyproto.github.io/splash/docs/" )
84- qNum := flags .Int ("q" , qn , "The number of results [min=1, max=10]" )
85- aNum := flags .Int ("a" , an , "The maximum number of answers for each result [min=1, max=10]" )
84+ qNum := flags .Int ("q" , qn , "The number of questions [min=1, max=10]" )
85+ aNum := flags .Int ("a" , an , "The number of answers for each result [min=1, max=10]" )
8686
8787 flags .Usage = func () {
8888 fmt .Print (usagePrefix )
@@ -93,11 +93,11 @@ func root(args []string) error {
9393 return err
9494 }
9595 if * qNum < 1 || * qNum > 10 {
96- * qNum = 1
96+ return fmt . Errorf ( "-q should be within [min=1, max=10]" )
9797 }
9898 conf .QuestionNum = * qNum
9999 if * aNum < 1 || * aNum > 10 {
100- * aNum = 1
100+ return fmt . Errorf ( "-a should be within [min=1, max=10]" )
101101 }
102102 conf .AnswerNum = * aNum
103103 apiKey , set := os .LookupEnv ("GOSO_API_KEY" )
0 commit comments