Skip to content

Commit cfd6102

Browse files
mehdi.cheracher@gmail.comchermehdi
authored andcommitted
Wip: refactor repeated test command code.
1 parent c659e35 commit cfd6102

File tree

6 files changed

+107
-185
lines changed

6 files changed

+107
-185
lines changed

commands/case.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func writeLinesToFile(filename string, lines []string) error {
3535
}
3636

3737
for _, line := range lines {
38-
fmt.Fprintln(f, line)
38+
_, err := fmt.Fprintln(f, line)
3939
if err != nil {
4040
return err
4141
}
@@ -121,7 +121,7 @@ func CustomCaseAction(context *cli.Context) error {
121121
}
122122
}
123123

124-
metaData.SaveToFile(path.Join(cwd, configFileName))
124+
err = metaData.SaveToFile(path.Join(cwd, configFileName))
125125

126126
if err != nil {
127127
color.Red("Failed to save to MetaData")
@@ -141,8 +141,8 @@ func CustomCaseAction(context *cli.Context) error {
141141
var CaseCommand = cli.Command{
142142
Name: "case",
143143
Aliases: []string{"tc", "testcase"},
144-
Usage: "Create a custom test case.",
145-
UsageText: "Add custom test cases to egor task.",
144+
UsageText: "egor case <--no-output?>",
145+
Usage: "Add custom test cases to egor task.",
146146
Action: CustomCaseAction,
147147
Flags: []cli.Flag{
148148
&cli.BoolFlag{

commands/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ var ConfigCommand = cli.Command{
8686
Name: "config",
8787
Aliases: []string{"c"},
8888
Usage: "Read/Change global configuration parameters",
89-
UsageText: "Read/Change global configuraiton parameters",
89+
UsageText: "egor config set <config.name> <config.value> | egor config get <config.name?>",
9090
Subcommands: []*cli.Command{
9191
{
9292
Name: "set",

commands/parse.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func ParseAction(_ *cli.Context) error {
174174
var ParseCommand = cli.Command{
175175
Name: "parse",
176176
Aliases: []string{"p"},
177-
Usage: "Parse a task using 'Competitive Companion'",
178-
UsageText: "parse task from navigator",
177+
Usage: "parse task from navigator",
178+
UsageText: "egor parse",
179179
Action: ParseAction,
180180
}

0 commit comments

Comments
 (0)