Skip to content

Commit f6b648c

Browse files
authored
Merge pull request #23 from chermehdi/feature-3/judge
Feature 3/judge
2 parents 8267a34 + 551612d commit f6b648c

13 files changed

+503
-29
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
2+
egor
23
go.sum

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2020 Mehdi Cheracher
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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/config_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ func getDefaultConfiguration() *config.Config {
2020
}
2121

2222
func TestSetConfiguration(t *testing.T) {
23-
config := getDefaultConfiguration()
23+
configuration := getDefaultConfiguration()
2424

25-
UpdateConfiguration(config, "server.port", "1245")
25+
_ = UpdateConfiguration(configuration, "server.port", "1245")
2626

27-
assert.Equal(t, config.Server.Port, 1245)
28-
assert.Equal(t, config.Lang.Default, "cpp")
27+
assert.Equal(t, configuration.Server.Port, 1245)
28+
assert.Equal(t, configuration.Lang.Default, "cpp")
2929

30-
UpdateConfiguration(config, "lang.default", "java")
31-
assert.Equal(t, config.Lang.Default, "java")
30+
_ = UpdateConfiguration(configuration, "lang.default", "java")
31+
assert.Equal(t, configuration.Lang.Default, "java")
3232
}
3333

3434
func TestSetConfigurationUnknownKey(t *testing.T) {
35-
config := getDefaultConfiguration()
36-
err := UpdateConfiguration(config, "unkown.key", "123")
35+
configuration := getDefaultConfiguration()
36+
err := UpdateConfiguration(configuration, "unkown.key", "123")
3737

3838
assert.Error(t, err, "Error should be returned if the key is unknown")
3939
}

commands/parse.go

+3-10
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func waitForShutDown(server *http.Server, done chan<- string, quit <-chan string
139139
done <- content
140140
}
141141

142-
func ParseAction(context *cli.Context) error {
142+
func ParseAction(_ *cli.Context) error {
143143
msgReceiveChannel := make(chan string, 1)
144144
msgReadChannel := make(chan string, 1)
145145

@@ -185,14 +185,7 @@ func ParseAction(context *cli.Context) error {
185185
var ParseCommand = cli.Command{
186186
Name: "parse",
187187
Aliases: []string{"p"},
188-
Usage: "Parse a task using 'Competitive Companion'",
189-
UsageText: "parse task from navigator",
188+
Usage: "parse task from navigator",
189+
UsageText: "egor parse",
190190
Action: ParseAction,
191-
//Flags: []cli.Flag{
192-
// //&cli.BoolFlag{
193-
// // Name: "cd",
194-
// // Aliases: []string{"c"},
195-
// // Usage: "Change to task directory after creating the task",
196-
// //},
197-
//},
198191
}

commands/parse_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func getDummyTaskJson() string {
2323
"languages" : {
2424
"java" : {
2525
"mainClass" : "Main",
26-
"taskClass" : "CMinimizeTheInteger"
26+
"taskClass" : "CMinimizeTheInteger"
2727
}
2828
},
2929
"input" : {

0 commit comments

Comments
 (0)