-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from obcode/rewriteDataStructure
Rewrite data structure
- Loading branch information
Showing
108 changed files
with
22,394 additions
and
9,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug plexams.go", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "main.go", | ||
"args": ["validate", "all"] | ||
} | ||
|
||
] | ||
} | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug plexams.go", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "main.go", | ||
"args": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"strconv" | ||
|
||
"github.com/logrusorgru/aurora" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
cacheCmd = &cobra.Command{ | ||
Use: "cache", | ||
Short: "cache [subcommand]", | ||
Long: `cache collections. | ||
exam <ancode> | ||
exams | ||
rm-exams | ||
`, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
plexams := initPlexamsConfig() | ||
switch args[0] { | ||
|
||
case "exam": | ||
if len(args) < 2 { | ||
log.Fatal("need ancode") | ||
} | ||
ancode, err := strconv.Atoi(args[1]) | ||
if err != nil { | ||
fmt.Printf("cannot use %s as ancode", args[1]) | ||
os.Exit(1) | ||
} | ||
|
||
err = plexams.CacheExam(ancode) | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
|
||
case "exams": | ||
err := plexams.CacheExams() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
|
||
case "rm-exams": | ||
err := plexams.RmCacheExams() | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
fmt.Println(aurora.Green("successfully removed the cached exams")) | ||
|
||
default: | ||
fmt.Println("cache called with unknown sub command") | ||
} | ||
}, | ||
} | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(cacheCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
csvCmd = &cobra.Command{ | ||
Use: "csv", | ||
Short: "csv [subcommand]", | ||
Long: `Generate various CSVs. | ||
draft [program] - generate csv for program | ||
exahm - csv for EXaHM/SEB exams.`, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
plexams := initPlexamsConfig() | ||
switch args[0] { | ||
case "draft": | ||
if len(args) < 2 { | ||
log.Fatal("need program") | ||
} | ||
program := args[1] | ||
if len(Csvfile) == 0 { | ||
Csvfile = fmt.Sprintf("VorläufigePrüfungsplanung_FK07_%s.csv", program) | ||
} | ||
fmt.Printf("generating %s\n", Csvfile) | ||
err := plexams.CsvForProgram(program, Csvfile) | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
|
||
case "exahm": | ||
if len(Csvfile) == 0 { | ||
Csvfile = "Prüfungsplanung_EXaHM_SEB_FK07.csv" | ||
} | ||
fmt.Printf("generating %s\n", Csvfile) | ||
err := plexams.CsvForEXaHM(Csvfile) | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
|
||
default: | ||
fmt.Println("pdf called with unknown sub command") | ||
} | ||
}, | ||
} | ||
Csvfile string | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(csvCmd) | ||
csvCmd.Flags().StringVarP(&Csvfile, "out", "o", "", "output (csv) file") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.