@@ -15,7 +15,7 @@ use anyhow::Context;
15
15
use util:: { Client , ClientProduction } ;
16
16
17
17
pub fn handle ( matches : & clap:: ArgMatches , io : & mut dyn Io ) -> anyhow:: Result < ( ) > {
18
- let mut client = ClientProduction :: new ( matches. is_present ( "testmode" ) ) ?;
18
+ let mut client = ClientProduction :: new ( matches. contains_id ( "testmode" ) ) ?;
19
19
20
20
// Authorize the client and raise error if not logged in when required
21
21
match matches. subcommand ( ) {
@@ -39,38 +39,38 @@ pub fn handle(matches: &clap::ArgMatches, io: &mut dyn Io) -> anyhow::Result<()>
39
39
40
40
match matches. subcommand ( ) {
41
41
Some ( ( "login" , args) ) => {
42
- let interactive_mode = !args. is_present ( "non-interactive" ) ;
42
+ let interactive_mode = !args. contains_id ( "non-interactive" ) ;
43
43
login:: login ( io, & mut client, interactive_mode) ?;
44
44
}
45
45
Some ( ( "download" , args) ) => download:: download_or_update (
46
46
io,
47
47
& mut client,
48
- args. value_of ( "course" ) ,
49
- args. is_present ( "currentdir" ) ,
48
+ args. get_one ( "course" ) . copied ( ) ,
49
+ args. contains_id ( "currentdir" ) ,
50
50
) ?,
51
51
Some ( ( "update" , args) ) => {
52
- update:: update ( io, & mut client, args. is_present ( "currentdir" ) ) ?;
52
+ update:: update ( io, & mut client, args. contains_id ( "currentdir" ) ) ?;
53
53
}
54
54
Some ( ( "organization" , args) ) => {
55
- let interactive_mode = !args. is_present ( "non-interactive" ) ;
55
+ let interactive_mode = !args. contains_id ( "non-interactive" ) ;
56
56
organization:: organization ( io, & mut client, interactive_mode) ?
57
57
}
58
58
Some ( ( "courses" , _) ) => courses:: list_courses ( io, & mut client) ?,
59
59
Some ( ( "submit" , args) ) => {
60
- submit:: submit ( io, & mut client, args. value_of ( "exercise" ) ) ?;
60
+ submit:: submit ( io, & mut client, args. get_one ( "exercise" ) . copied ( ) ) ?;
61
61
}
62
62
Some ( ( "exercises" , args) ) => {
63
- if let Some ( c) = args. value_of ( "course" ) {
63
+ if let Some ( c) = args. get_one ( "course" ) . copied ( ) {
64
64
exercises:: list_exercises ( io, & mut client, c) ?;
65
65
} else {
66
66
io. println ( "argument for course not found" , PrintColor :: Normal ) ?;
67
67
}
68
68
}
69
69
Some ( ( "test" , args) ) => {
70
- test:: test ( io, args. value_of ( "exercise" ) ) ?;
70
+ test:: test ( io, args. get_one ( "exercise" ) . copied ( ) ) ?;
71
71
}
72
72
Some ( ( "paste" , args) ) => {
73
- paste:: paste ( io, & mut client, args. value_of ( "exercise" ) ) ?;
73
+ paste:: paste ( io, & mut client, args. get_one ( "exercise" ) . copied ( ) ) ?;
74
74
}
75
75
Some ( ( "logout" , _) ) => logout:: logout ( io, & mut client) ?,
76
76
Some ( ( "fetchupdate" , _) ) => {
0 commit comments