Skip to content

Commit

Permalink
fix: fixed unix timestamp unit help message (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
pamburus authored Mar 24, 2024
1 parent d7474a1 commit 5ac8ad6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["command-line-utilities"]
description = "Utility for viewing json-formatted log files."
keywords = ["cli", "human", "log"]
name = "hl"
version = "0.27.0-beta.4.7"
version = "0.27.0-beta.4.8"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ Options:
-Z, --time-zone <TIME_ZONE> Time zone name, see column "TZ identifier" at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones [env: HL_TIME_ZONE=] [default: UTC]
-L, --local Use local time zone, overrides --time-zone option
--no-local Disable local time zone, overrides --local option
--unix-timestamp-unit <UNIX_TIMESTAMP_UNIT> Unix timestamp unit, [auto, s, ms, us, ns] [env: HL_UNIX_TIMESTAMP_UNIT=] [default: auto] [possible values: auto, s, ms, us, ns]
--unix-timestamp-unit <UNIX_TIMESTAMP_UNIT> Unix timestamp unit [env: HL_UNIX_TIMESTAMP_UNIT=] [default: auto] [possible values: auto, s, ms, us, ns]
-e, --hide-empty-fields Hide empty fields, applies for null, string, object and array fields only [env: HL_HIDE_EMPTY_FIELDS=]
-E, --show-empty-fields Show empty fields, overrides --hide-empty-fields option [env: HL_SHOW_EMPTY_FIELDS=]
--input-info <INPUT_INFO> Show input number and/or input filename before each message [default: auto] [possible values: auto, none, full, compact, minimal]
Expand Down
1 change: 1 addition & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl UnixTimestampUnit {
const TS_UNIX_AUTO_US_MIN: i64 = Self::TS_UNIX_AUTO_MS_MIN * 1000;
const TS_UNIX_AUTO_US_MAX: i64 = Self::TS_UNIX_AUTO_MS_MAX * 1000;
}

// ---

pub struct App {
Expand Down
19 changes: 10 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::num::NonZeroUsize;

// local imports
use hl::{
app,
datefmt::LinuxDateFormat,
error::*,
input::InputReference,
Expand Down Expand Up @@ -155,7 +156,7 @@ struct Opt {
#[arg(long, overrides_with = "local")]
_no_local: bool,

/// Unix timestamp unit, [auto, s, ms, us, ns].
/// Unix timestamp unit.
#[arg(
long,
default_value = "auto",
Expand Down Expand Up @@ -459,11 +460,11 @@ fn run() -> Result<()> {
follow: opt.follow,
sync_interval: Duration::from_millis(opt.sync_interval_ms),
input_info: match opt.input_info {
InputInfoOption::Auto => Some(hl::app::InputInfo::Auto),
InputInfoOption::Auto => Some(app::InputInfo::Auto),
InputInfoOption::None => None,
InputInfoOption::Full => Some(hl::app::InputInfo::Full),
InputInfoOption::Compact => Some(hl::app::InputInfo::Compact),
InputInfoOption::Minimal => Some(hl::app::InputInfo::Minimal),
InputInfoOption::Full => Some(app::InputInfo::Full),
InputInfoOption::Compact => Some(app::InputInfo::Compact),
InputInfoOption::Minimal => Some(app::InputInfo::Minimal),
},
dump_index: opt.dump_index,
debug: opt.debug,
Expand All @@ -472,10 +473,10 @@ fn run() -> Result<()> {
delimiter,
unix_ts_unit: match opt.unix_timestamp_unit {
UnixTimestampUnit::Auto => None,
UnixTimestampUnit::S => Some(hl::app::UnixTimestampUnit::Seconds),
UnixTimestampUnit::Ms => Some(hl::app::UnixTimestampUnit::Milliseconds),
UnixTimestampUnit::Us => Some(hl::app::UnixTimestampUnit::Microseconds),
UnixTimestampUnit::Ns => Some(hl::app::UnixTimestampUnit::Nanoseconds),
UnixTimestampUnit::S => Some(app::UnixTimestampUnit::Seconds),
UnixTimestampUnit::Ms => Some(app::UnixTimestampUnit::Milliseconds),
UnixTimestampUnit::Us => Some(app::UnixTimestampUnit::Microseconds),
UnixTimestampUnit::Ns => Some(app::UnixTimestampUnit::Nanoseconds),
},
});

Expand Down

0 comments on commit 5ac8ad6

Please sign in to comment.