Skip to content

Commit

Permalink
Merge pull request #366 from mknos/date-usage
Browse files Browse the repository at this point in the history
date: show usage for bad options
  • Loading branch information
briandfoy authored Dec 4, 2023
2 parents 0f5b938 + 3d5ebd6 commit 8a7b826
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/date
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sub run {
foreach (@$args) {
if( /^-/ and ! exists $allowed{$_} ) {
print STDERR "Unrecognized option $_\n";
exit(2);
usage(2);
}

if( /^\-u/ ) { $TZ = $ENV{'TZ'} = 'UTC'; my @times = CORE::gmtime; *core_time = sub { @times } }
Expand Down Expand Up @@ -94,7 +94,7 @@ sub select_format {
sub setup_specifiers {
my %specifiers = (
'e' => sprintf( '% 2d', (core_time)[3] ),
'P' => lc( ( core_time() )[2] >= 12 ? "PM" : "AM" ),
'P' => lc(POSIX::strftime('%p', core_time())),
'q' => quarter(),
'T' => sprintf( '%02d:%02d:%02d', (core_time)[2,1,0] ),
'z' => tz_offset(),
Expand Down Expand Up @@ -140,7 +140,7 @@ sub usage {
my $exit_code = defined $_[0] ? $_[0] : 0;

my $output = <<"HEADER";
usage: $0 [-fhIRuv] [+format]
usage: $0 [-hIRuv] [+format]
Formats:
HEADER
Expand Down

0 comments on commit 8a7b826

Please sign in to comment.