mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 13:07:46 +00:00
commit
775588fb18
2 changed files with 29 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
//
|
||||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
// spell-checker:ignore itotal iused iavail ipcent pcent
|
||||
mod table;
|
||||
|
||||
#[cfg(unix)]
|
||||
|
@ -47,6 +48,10 @@ static OPT_SYNC: &str = "sync";
|
|||
static OPT_TYPE: &str = "type";
|
||||
static OPT_PRINT_TYPE: &str = "print-type";
|
||||
static OPT_EXCLUDE_TYPE: &str = "exclude-type";
|
||||
static OUTPUT_FIELD_LIST: [&str; 12] = [
|
||||
"source", "fstype", "itotal", "iused", "iavail", "ipcent", "size", "used", "avail", "pcent",
|
||||
"file", "target",
|
||||
];
|
||||
|
||||
/// Store names of file systems as a selector.
|
||||
/// Note: `exclude` takes priority over `include`.
|
||||
|
@ -355,6 +360,10 @@ pub fn uu_app<'a>() -> App<'a> {
|
|||
.long("output")
|
||||
.takes_value(true)
|
||||
.use_delimiter(true)
|
||||
.possible_values(OUTPUT_FIELD_LIST)
|
||||
.default_missing_values(&OUTPUT_FIELD_LIST)
|
||||
.default_values(&["source", "size", "used", "avail", "pcent", "target"])
|
||||
.conflicts_with_all(&[OPT_INODES, OPT_PORTABILITY, OPT_PRINT_TYPE])
|
||||
.help(
|
||||
"use the output format defined by FIELD_LIST,\
|
||||
or print all fields if FIELD_LIST is omitted.",
|
||||
|
@ -378,7 +387,7 @@ pub fn uu_app<'a>() -> App<'a> {
|
|||
.long("type")
|
||||
.allow_invalid_utf8(true)
|
||||
.takes_value(true)
|
||||
.use_delimiter(true)
|
||||
.multiple_occurrences(true)
|
||||
.help("limit listing to file systems of type TYPE"),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -58,4 +58,23 @@ fn test_order_same() {
|
|||
assert_eq!(output1, output2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_output_conflict_options() {
|
||||
for option in ["-i", "-T", "-P"] {
|
||||
new_ucmd!().arg("--output=source").arg(option).fails();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_output_option() {
|
||||
new_ucmd!().arg("--output").succeeds();
|
||||
new_ucmd!().arg("--output=source,target").succeeds();
|
||||
new_ucmd!().arg("--output=invalid_option").fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_type_option() {
|
||||
new_ucmd!().args(&["-t", "ext4", "-t", "ext3"]).succeeds();
|
||||
}
|
||||
|
||||
// ToDO: more tests...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue