@@ -7,8 +7,10 @@ use std::io::{self, Write};
7
7
use std:: process:: exit;
8
8
9
9
fn find ( ) -> io:: Result < ( ) > {
10
- let loopdev = LoopControl :: open ( ) ?. next_free ( ) ?;
11
- println ! ( "{}" , loopdev. path( ) . unwrap( ) . display( ) ) ;
10
+ println ! (
11
+ "{}" ,
12
+ LoopControl :: open( ) ?. next_free( ) ?. path( ) . unwrap( ) . display( )
13
+ ) ;
12
14
Ok ( ( ) )
13
15
}
14
16
@@ -17,9 +19,10 @@ fn attach(matches: &clap::ArgMatches) -> io::Result<()> {
17
19
let image = matches. value_of ( "image" ) . unwrap ( ) ;
18
20
let offset = value_t ! ( matches. value_of( "offset" ) , u64 ) . unwrap_or ( 0 ) ;
19
21
let size_limit = value_t ! ( matches. value_of( "sizelimit" ) , u64 ) . unwrap_or ( 0 ) ;
20
- let read_only = matches. is_present ( "read-only" ) ;
21
- let autoclear = matches. is_present ( "autoclear" ) ;
22
- let mut loopdev = match matches. value_of ( "loopdev" ) {
22
+ let read_only = matches. is_present ( "read_only" ) ;
23
+ let auto_clear = matches. is_present ( "auto_clear" ) ;
24
+ let part_scan = matches. is_present ( "part_scan" ) ;
25
+ let loopdev = match matches. value_of ( "loopdev" ) {
23
26
Some ( loopdev) => LoopDevice :: open ( & loopdev) ?,
24
27
None => LoopControl :: open ( ) . and_then ( |lc| lc. next_free ( ) ) ?,
25
28
} ;
@@ -28,7 +31,8 @@ fn attach(matches: &clap::ArgMatches) -> io::Result<()> {
28
31
. offset ( offset)
29
32
. size_limit ( size_limit)
30
33
. read_only ( read_only)
31
- . autoclear ( autoclear)
34
+ . autoclear ( auto_clear)
35
+ . part_scan ( part_scan)
32
36
. attach ( image) ?;
33
37
34
38
if !quiet {
@@ -69,8 +73,9 @@ fn main() {
69
73
( @arg loopdev: "the loop device to attach" )
70
74
( @arg offset: -o --offset +takes_value "the offset within the file to start at" )
71
75
( @arg sizelimit: -s --sizelimit +takes_value "the file is limited to this size" )
72
- ( @arg read_only: -r --read-only "set up a read-only loop device" )
73
- ( @arg autoclear: -a --autoclear "set the autoclear flag" )
76
+ ( @arg read_only: -r --readonly "set up a read-only loop device" )
77
+ ( @arg auto_clear: -a --autoclear "set the autoclear flag" )
78
+ ( @arg part_scan: -p --partscan "set the part-scan flag" )
74
79
( @arg quiet: -q --quiet "don't print the device name" )
75
80
)
76
81
( @subcommand detach =>
0 commit comments