Skip to content

Commit

Permalink
Add aliases, change help text
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Oct 27, 2018
1 parent caad43f commit deea31c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
28 changes: 19 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit deea31c

Please sign in to comment.