Add aliases, change help text

This commit is contained in:
sharkdp 2018-10-27 15:34:10 +02:00
parent caad43fe6c
commit deea31cbbc
2 changed files with 21 additions and 11 deletions

View file

@ -172,13 +172,17 @@ pub fn build_app() -> App<'static, 'static> {
.arg(
arg("changed-within")
.long("changed-within")
.alias("change-newer-than")
.takes_value(true)
.value_name("date|dur")
.number_of_values(1),
)
.arg(
arg("changed-before")
.long("changed-before")
.alias("change-older-than")
.takes_value(true)
.value_name("date|dur")
.number_of_values(1),
)
.arg(arg("show-errors").long("show-errors"))
@ -313,16 +317,22 @@ fn usage() -> HashMap<&'static str, Help> {
'mi': mebibytes\n \
'gi': gibibytes\n \
'ti': tebibytes");
doc!(h, "changed-before"
, "Limit results based on modification time older than duration or date provided."
, "Limit results based on modification time older than duration provided:\n \
using a duration: <NUM>d <NUM>h <NUM>m <NUM>s (e.g. 10h, 1d, 35min...)\n \
or a date and time: YYYY-MM-DD HH:MM:SS");
doc!(h, "changed-within"
, "Limit results based on modification time within the duration provided or between date provided and now."
, "Limit results based on modification time within the duration provided:\n \
using a duration: <NUM>d <NUM>h <NUM>m <NUM>s (e.g. 10h, 1d, 35min...)\n \
or a date and time: YYYY-MM-DD HH:MM:SS");
, "Filter by file modification time (newer than)"
, "Filter results based on the file modification time. The argument can be provided \
as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \
'--change-newer-than' can be used as an alias.\n\
Examples:\n \
--changed-within 2weeks\n \
--change-newer-than '2018-10-27 10:00:00'");
doc!(h, "changed-before"
, "Filter by file modification time (older than)"
, "Filter results based on the file modification time. The argument can be provided \
as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \
'--change-older-than' can be used as an alias.\n\
Examples:\n \
--changed-before '2018-10-27 10:00:00'\n \
--change-older-than 2weeks");
doc!(h, "show-errors"
, "Enable display of filesystem errors"
, "Enable the display of filesystem errors for situations such as insufficient permissions \

View file

@ -1140,7 +1140,7 @@ fn test_modified_relative() {
);
te.assert_output(
&["", "--changed-before", "15min"],
&["", "--change-older-than", "15min"],
"bar_1_h
foo_2_h
bar_1_day",
@ -1168,7 +1168,7 @@ fn test_modified_asolute() {
change_file_modified(te.test_root().join("30dec2017"), "2017-12-30T23:59:00Z");
te.assert_output(
&["", "--changed-within", "2018-01-01 00:00:00"],
&["", "--change-newer-than", "2018-01-01 00:00:00"],
"15mar2018",
);
te.assert_output(