/// Applies the basic command line arguments to a configuration.
///
/// The path arguments in `matches` will be interpreted relative to
/// `cur_dir`.
///
/// This functions prints all its error messages directly to stderr.
Applies the basic command line arguments to a configuration.
The path arguments in `matches` will be interpreted relative to
`cur_dir`.

This functions prints all its error messages directly to stderr.
Applies the basic command line arguments to a configuration . The path arguments in ` matches ` will be interpreted relative to ` cur_dir ` . This functions prints all its error messages directly to stderr .
fn apply_arg_matches(
        &mut self,
        matches: &ArgMatches,
        cur_dir: &Path,
    ) -> Result<(), Error> {
        // cache_dir
        if let Some(dir) = matches.value_of("repository-dir") {
            self.cache_dir = cur_dir.join(dir)
        }
        else if let Some(dir) = matches.value_of("base-dir") {
            self.cache_dir = cur_dir.join(dir).join("repository")
        }
        if self.cache_dir == Path::new("") {
            eprintln!(
                "Couldn’t determine default repository directory: \
                 no home directory.\n\
                 Please specify the repository directory with the -r option."
            );
            return Err(Error)
        }
        // tal_dir
        if let Some(dir) = matches.value_of("tal-dir") {
            self.tal_dir = cur_dir.join(dir)
        }
        else if let Some(dir) = matches.value_of("base-dir") {
            self.tal_dir = cur_dir.join(dir).join("tals")
        }
        if self.tal_dir == Path::new("") {
            eprintln!(
                "Couldn’t determine default TAL directory: \
                 no home directory.\n\
                 Please specify the repository directory with the -t option."
            );
            return Err(Error)
        }
        // expceptions
        if let Some(list) = matches.values_of("exceptions") {
            self.exceptions = list.map(|path| cur_dir.join(path)).collect()
        }
        // strict
        if matches.is_present("strict") {
            self.strict = true
        }
        // rsync_command
        if let Some(value) = matches.value_of("rsync-command") {
            self.rsync_command = value.into()
        }
        // rsync_count
        if let Some(value) = from_str_value_of(matches, "rsync-count")? {
            self.rsync_count = value
        }
        // rsync_timeout
        if let Some(value) = from_str_value_of(matches, "rsync-timeout")? {
            self.rsync_timeout = Duration::from_secs(value)
        }
        // validation_threads
        if let Some(value) = from_str_value_of(matches, "validation-threads")? {
            self.validation_threads = value
        }
        // log_level
        match (matches.occurrences_of("verbose"),
                                            matches.occurrences_of("quiet")) {
            // This assumes that -v and -q are conflicting.
            (0, 0) => { }
            (1, 0) => self.log_level = LevelFilter::Info,
            (_, 0) => self.log_level = LevelFilter::Debug,
            (0, 1) => self.log_level = LevelFilter::Error,
            (0, _) => self.log_level = LevelFilter::Off,
            _ => { }
        }
        // log_target
        self.apply_log_matches(matches, cur_dir)?;
        Ok(())
    }
fn apply_arg_matches ( & mut self , matches : & ArgMatches , cur_dir : & Path , ) -> Result < ( ) , Error > { // cache_dir if let Some ( dir ) = matches . value_of ( " " ) { self . cache_dir = cur_dir . join ( dir ) } else if let Some ( dir ) = matches . value_of ( " " ) { self . cache_dir = cur_dir . join ( dir ) . join ( " " ) } if self . cache_dir == Path :: new ( " " ) { eprintln ! ( " \n \
 " ) ; return Err ( Error ) } // tal_dir if let Some ( dir ) = matches . value_of ( " " ) { self . tal_dir = cur_dir . join ( dir ) } else if let Some ( dir ) = matches . value_of ( " " ) { self . tal_dir = cur_dir . join ( dir ) . join ( " " ) } if self . tal_dir == Path :: new ( " " ) { eprintln ! ( " \n \
 " ) ; return Err ( Error ) } // expceptions if let Some ( list ) = matches . values_of ( " " ) { self . exceptions = list . map ( | path | cur_dir . join ( path ) ) . collect ( ) } // strict if matches . is_present ( " " ) { self . strict = true } // rsync_command if let Some ( value ) = matches . value_of ( " " ) { self . rsync_command = value . into ( ) } // rsync_count if let Some ( value ) = from_str_value_of ( matches , " " ) ? { self . rsync_count = value } // rsync_timeout if let Some ( value ) = from_str_value_of ( matches , " " ) ? { self . rsync_timeout = Duration :: from_secs ( value ) } // validation_threads if let Some ( value ) = from_str_value_of ( matches , " " ) ? { self . validation_threads = value } // log_level match ( matches . occurrences_of ( " " ) , matches . occurrences_of ( " " ) ) { // This assumes that -v and -q are conflicting. ( 0 , 0 ) => { } ( 1 , 0 ) => self . log_level = LevelFilter :: Info , ( _ , 0 ) => self . log_level = LevelFilter :: Debug , ( 0 , 1 ) => self . log_level = LevelFilter :: Error , ( 0 , _ ) => self . log_level = LevelFilter :: Off , _ => { } } // log_target self . apply_log_matches ( matches , cur_dir ) ? ; Ok ( ( ) ) }
Applies the basic command line arguments to a configuration.
Applies the basic command line arguments to a configuration .
&mut self
matches
&ArgMatches
cur_dir
&Path