File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ func main() {
2424 ShortName : "c" ,
2525 Usage : "Show the current assignments" ,
2626 Action : func (c * cli.Context ) {
27+ var language string
28+ argc := len (c .Args ())
29+ if argc != 0 && argc != 1 {
30+ fmt .Println ("Usage: exercism current\n or: exercism current LANGUAGE" )
31+ return
32+ }
33+
2734 config , err := configuration .FromFile (c .GlobalString ("config" ))
2835 if err != nil {
2936 fmt .Println ("Are you sure you are logged in? Please login again." )
@@ -35,10 +42,21 @@ func main() {
3542 return
3643 }
3744
38- fmt .Println ("Current Assignments" )
45+ if argc == 1 {
46+ language = c .Args ()[0 ]
47+ fmt .Println ("Current Assignments for" , strings .Title (language ))
48+ } else {
49+ fmt .Println ("Current Assignments" )
50+ }
3951
4052 for _ , a := range currentAssignments {
41- fmt .Printf ("%v: %v\n " , strings .Title (a .Track ), a .Slug )
53+ if argc == 1 {
54+ if strings .ToLower (language ) == strings .ToLower (a .Track ) {
55+ fmt .Printf ("%v: %v\n " , strings .Title (a .Track ), a .Slug )
56+ }
57+ } else {
58+ fmt .Printf ("%v: %v\n " , strings .Title (a .Track ), a .Slug )
59+ }
4260 }
4361 },
4462 },
You can’t perform that action at this time.
0 commit comments