@@ -15,7 +15,7 @@ use anyhow::Context;
1515use util:: { Client , ClientProduction } ;
1616
1717pub 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" ) ) ?;
1919
2020 // Authorize the client and raise error if not logged in when required
2121 match matches. subcommand ( ) {
@@ -39,38 +39,38 @@ pub fn handle(matches: &clap::ArgMatches, io: &mut dyn Io) -> anyhow::Result<()>
3939
4040 match matches. subcommand ( ) {
4141 Some ( ( "login" , args) ) => {
42- let interactive_mode = !args. is_present ( "non-interactive" ) ;
42+ let interactive_mode = !args. contains_id ( "non-interactive" ) ;
4343 login:: login ( io, & mut client, interactive_mode) ?;
4444 }
4545 Some ( ( "download" , args) ) => download:: download_or_update (
4646 io,
4747 & mut client,
48- args. value_of ( "course" ) ,
49- args. is_present ( "currentdir" ) ,
48+ args. get_one ( "course" ) . copied ( ) ,
49+ args. contains_id ( "currentdir" ) ,
5050 ) ?,
5151 Some ( ( "update" , args) ) => {
52- update:: update ( io, & mut client, args. is_present ( "currentdir" ) ) ?;
52+ update:: update ( io, & mut client, args. contains_id ( "currentdir" ) ) ?;
5353 }
5454 Some ( ( "organization" , args) ) => {
55- let interactive_mode = !args. is_present ( "non-interactive" ) ;
55+ let interactive_mode = !args. contains_id ( "non-interactive" ) ;
5656 organization:: organization ( io, & mut client, interactive_mode) ?
5757 }
5858 Some ( ( "courses" , _) ) => courses:: list_courses ( io, & mut client) ?,
5959 Some ( ( "submit" , args) ) => {
60- submit:: submit ( io, & mut client, args. value_of ( "exercise" ) ) ?;
60+ submit:: submit ( io, & mut client, args. get_one ( "exercise" ) . copied ( ) ) ?;
6161 }
6262 Some ( ( "exercises" , args) ) => {
63- if let Some ( c) = args. value_of ( "course" ) {
63+ if let Some ( c) = args. get_one ( "course" ) . copied ( ) {
6464 exercises:: list_exercises ( io, & mut client, c) ?;
6565 } else {
6666 io. println ( "argument for course not found" , PrintColor :: Normal ) ?;
6767 }
6868 }
6969 Some ( ( "test" , args) ) => {
70- test:: test ( io, args. value_of ( "exercise" ) ) ?;
70+ test:: test ( io, args. get_one ( "exercise" ) . copied ( ) ) ?;
7171 }
7272 Some ( ( "paste" , args) ) => {
73- paste:: paste ( io, & mut client, args. value_of ( "exercise" ) ) ?;
73+ paste:: paste ( io, & mut client, args. get_one ( "exercise" ) . copied ( ) ) ?;
7474 }
7575 Some ( ( "logout" , _) ) => logout:: logout ( io, & mut client) ?,
7676 Some ( ( "fetchupdate" , _) ) => {
0 commit comments