mirror of
https://codeberg.org/flpolyaplus/aplus.git
synced 2024-11-22 09:20:30 -05:00
add short flags for rest of the flags and print usage when no flags are present
This commit is contained in:
parent
d425358bd0
commit
ba523ee94e
8
main.go
8
main.go
@ -19,13 +19,13 @@ func main() {
|
|||||||
|
|
||||||
code := getopt.StringLong("code", 'c', "", "Code to enter")
|
code := getopt.StringLong("code", 'c', "", "Code to enter")
|
||||||
course := getopt.IntLong("course", 'C', -1, "Canvas course number")
|
course := getopt.IntLong("course", 'C', -1, "Canvas course number")
|
||||||
list_all := getopt.BoolLong("list-all", 0, "List all courses")
|
list_all := getopt.BoolLong("list-all", 'L', "List all courses")
|
||||||
list_favorites := getopt.BoolLong("list-favorites", 0, "List favorite courses")
|
list_favorites := getopt.BoolLong("list-favorites", 'F', "List favorite courses")
|
||||||
help := getopt.BoolLong("help", 0, "Help")
|
help := getopt.BoolLong("help", 'h', "Help")
|
||||||
|
|
||||||
getopt.Parse()
|
getopt.Parse()
|
||||||
|
|
||||||
if *help {
|
if *help || (*list_all == false && *list_favorites == false && *code == "" && *course == -1) {
|
||||||
getopt.Usage()
|
getopt.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user