Expand description
Implement GNU-style update functionality.
- pre-defined
clap-Arguments for inclusion in utilities that implement updates - determination of the update mode
Update-functionality is implemented by the following utilities:
cpmv
§Usage example
#[macro_use]
extern crate uucore;
use clap::{Command, Arg, ArgMatches};
use uucore::update_control::{self, UpdateMode};
fn main() {
let matches = Command::new("command")
.arg(update_control::arguments::update())
.arg(update_control::arguments::update_no_args())
.get_matches_from(vec![
"command", "--update=older"
]);
let update_mode = update_control::determine_update_mode(&matches);
// handle cases
if update_mode == UpdateMode::IfOlder {
// do
} else {
unreachable!()
}
}Modules§
- arguments
- Pre-defined arguments for update functionality.
Enums§
- Update
Mode - Available update mode
Functions§
- determine_
update_ mode - Determine the “mode” for the update operation to perform, if any.