1- #[ cfg( target_os = "windows" ) ]
2- use crate :: updater;
3- use command_util:: { get_organization, Client , ClientProduction } ;
4- use courses_command:: list_courses;
5- use download_command:: download_or_update;
6- use exercises_command:: list_exercises;
7- use login_command:: login;
8- use logout_command:: logout;
9- use organization_command:: organization;
10- use update_command:: update;
11- pub mod command_util;
12- mod courses_command;
13- mod download_command;
14- mod exercises_command;
15- mod login_command;
16- mod logout_command;
17- mod organization_command;
18- mod paste_command;
19- mod submit_command;
20- mod test_command;
21- mod update_command;
1+ mod courses;
2+ mod download;
3+ mod exercises;
4+ mod login;
5+ mod logout;
6+ mod organization;
7+ mod paste;
8+ mod submit;
9+ mod test;
10+ mod update;
11+ mod util;
2212
23- use crate :: io_module:: { Io , PrintColor } ;
13+ use crate :: io:: { Io , PrintColor } ;
14+ use util:: { Client , ClientProduction } ;
2415
2516pub fn handle ( matches : & clap:: ArgMatches , io : & mut dyn Io ) {
2617 let mut client = ClientProduction :: new ( matches. is_present ( "testmode" ) ) ;
@@ -50,7 +41,7 @@ pub fn handle(matches: &clap::ArgMatches, io: &mut dyn Io) {
5041
5142 // Check that organization is set
5243 if let Some ( ( "download" | "courses" , _) ) = matches. subcommand ( ) {
53- if get_organization ( ) . is_none ( ) {
44+ if util :: get_organization ( ) . is_none ( ) {
5445 io. println (
5546 "No organization found. Run 'tmc organization' first." ,
5647 PrintColor :: Failed ,
@@ -62,52 +53,52 @@ pub fn handle(matches: &clap::ArgMatches, io: &mut dyn Io) {
6253 match matches. subcommand ( ) {
6354 Some ( ( "login" , args) ) => {
6455 let interactive_mode = !args. is_present ( "non-interactive" ) ;
65- login ( io, & mut client, interactive_mode)
56+ login:: login ( io, & mut client, interactive_mode)
6657 }
67- Some ( ( "download" , args) ) => download_or_update (
58+ Some ( ( "download" , args) ) => download :: download_or_update (
6859 io,
6960 & mut client,
7061 args. value_of ( "course" ) ,
7162 args. is_present ( "currentdir" ) ,
7263 ) ,
7364 Some ( ( "update" , args) ) => {
74- update ( io, & mut client, args. is_present ( "currentdir" ) ) ;
65+ update:: update ( io, & mut client, args. is_present ( "currentdir" ) ) ;
7566 }
7667 Some ( ( "organization" , args) ) => {
7768 let interactive_mode = !args. is_present ( "non-interactive" ) ;
78- organization ( io, & mut client, interactive_mode)
69+ organization:: organization ( io, & mut client, interactive_mode)
7970 }
80- Some ( ( "courses" , _) ) => list_courses ( io, & mut client) ,
71+ Some ( ( "courses" , _) ) => courses :: list_courses ( io, & mut client) ,
8172 Some ( ( "submit" , args) ) => {
82- submit_command :: submit ( io, & mut client, args. value_of ( "exercise" ) ) ;
73+ submit :: submit ( io, & mut client, args. value_of ( "exercise" ) ) ;
8374 }
8475 Some ( ( "exercises" , args) ) => {
8576 if let Some ( c) = args. value_of ( "course" ) {
86- list_exercises ( io, & mut client, String :: from ( c ) ) ;
77+ exercises :: list_exercises ( io, & mut client, c ) ;
8778 } else {
8879 io. println ( "argument for course not found" , PrintColor :: Normal ) ;
8980 }
9081 }
9182 Some ( ( "test" , args) ) => {
92- test_command :: test ( io, args. value_of ( "exercise" ) ) ;
83+ test :: test ( io, args. value_of ( "exercise" ) ) ;
9384 }
9485 Some ( ( "paste" , args) ) => {
95- paste_command :: paste ( io, & mut client, args. value_of ( "exercise" ) ) ;
86+ paste :: paste ( io, & mut client, args. value_of ( "exercise" ) ) ;
9687 }
97- Some ( ( "logout" , _) ) => logout ( io, & mut client) ,
88+ Some ( ( "logout" , _) ) => logout:: logout ( io, & mut client) ,
9889 Some ( ( "fetchupdate" , _) ) => {
9990 #[ cfg( target_os = "windows" ) ]
100- updater:: process_update ( ) ;
91+ crate :: updater:: process_update ( ) ;
10192 }
10293 Some ( ( "cleartemp" , _) ) => {
10394 #[ cfg( target_os = "windows" ) ]
104- updater:: cleartemp ( ) . unwrap ( ) ;
95+ crate :: updater:: cleartemp ( ) . unwrap ( ) ;
10596 }
10697 Some ( ( "elevateddownload" , _) ) => {
107- download_command :: elevated_download ( io, & mut client) ;
98+ download :: elevated_download ( io, & mut client) ;
10899 }
109100 Some ( ( "elevatedupdate" , _) ) => {
110- update_command :: elevated_update ( io, & mut client) ;
101+ update :: elevated_update ( io, & mut client) ;
111102 }
112103 _ => ( ) , // Unknown subcommand or no subcommand was given
113104 }
0 commit comments