@@ -13,7 +13,7 @@ use std::{
1313 time:: SystemTime ,
1414} ;
1515
16- use clap:: { App , Arg } ;
16+ use clap:: { Arg , ArgAction , Command } ;
1717use dokan:: {
1818 init, shutdown, unmount, CreateFileInfo , DiskSpaceInfo , FileInfo , FileSystemHandler ,
1919 FileSystemMounter , FileTimeOperation , FillDataError , FillDataResult , FindData , FindStreamData ,
@@ -1280,49 +1280,52 @@ impl<'c, 'h: 'c> FileSystemHandler<'c, 'h> for MemFsHandler {
12801280}
12811281
12821282fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
1283- let matches = App :: new ( "dokan-rust memfs example" )
1283+ let matches = Command :: new ( "dokan-rust memfs example" )
12841284 . author ( env ! ( "CARGO_PKG_AUTHORS" ) )
12851285 . arg (
1286- Arg :: with_name ( "mount_point" )
1287- . short ( "m" )
1286+ Arg :: new ( "mount_point" )
1287+ . short ( 'm' )
12881288 . long ( "mount-point" )
1289- . takes_value ( true )
1289+ . num_args ( 1 )
12901290 . value_name ( "MOUNT_POINT" )
12911291 . required ( true )
12921292 . help ( "Mount point path." ) ,
12931293 )
12941294 . arg (
1295- Arg :: with_name ( "single_thread" )
1296- . short ( "t" )
1295+ Arg :: new ( "single_thread" )
1296+ . short ( 't' )
12971297 . long ( "single-thread" )
1298- . help ( "Force a single thread. Otherwise Dokan will allocate the number of threads regarding the workload." ) ,
1298+ . help ( "Force a single thread. Otherwise Dokan will allocate the number of threads regarding the workload." )
1299+ . action ( ArgAction :: SetTrue ) ,
12991300 )
13001301 . arg (
1301- Arg :: with_name ( "dokan_debug" )
1302- . short ( "d" )
1302+ Arg :: new ( "dokan_debug" )
1303+ . short ( 'd' )
13031304 . long ( "dokan-debug" )
1304- . help ( "Enable Dokan's debug output." ) ,
1305+ . help ( "Enable Dokan's debug output." )
1306+ . action ( ArgAction :: SetTrue ) ,
13051307 )
13061308 . arg (
1307- Arg :: with_name ( "removable" )
1308- . short ( "r" )
1309+ Arg :: new ( "removable" )
1310+ . short ( 'r' )
13091311 . long ( "removable" )
1310- . help ( "Mount as a removable drive." ) ,
1312+ . help ( "Mount as a removable drive." )
1313+ . action ( ArgAction :: SetTrue ) ,
13111314 )
13121315 . get_matches ( ) ;
13131316
1314- let mount_point = U16CString :: from_str ( matches. value_of ( "mount_point" ) . unwrap ( ) ) ?;
1317+ let mount_point = U16CString :: from_str ( matches. get_one :: < String > ( "mount_point" ) . unwrap ( ) ) ?;
13151318
13161319 let mut flags = MountFlags :: ALT_STREAM ;
1317- if matches. is_present ( "dokan_debug" ) {
1320+ if matches. get_flag ( "dokan_debug" ) {
13181321 flags |= MountFlags :: DEBUG | MountFlags :: STDERR ;
13191322 }
1320- if matches. is_present ( "removable" ) {
1323+ if matches. get_flag ( "removable" ) {
13211324 flags |= MountFlags :: REMOVABLE ;
13221325 }
13231326
13241327 let options = MountOptions {
1325- single_thread : matches. is_present ( "single_thread" ) ,
1328+ single_thread : matches. get_flag ( "single_thread" ) ,
13261329 flags,
13271330 ..Default :: default ( )
13281331 } ;
0 commit comments