From 00c6f37995ae2c041a469cacb0af92fd548496b3 Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Sun, 24 Mar 2024 11:03:30 +0100 Subject: [PATCH] fix: fixed unix timestamp unit help message --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 2 +- src/app.rs | 1 + src/main.rs | 19 ++++++++++--------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2bad3ba8..28e3c400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -738,7 +738,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hl" -version = "0.27.0-beta.4.7" +version = "0.27.0-beta.4.8" dependencies = [ "atoi", "bincode", diff --git a/Cargo.toml b/Cargo.toml index fa5e89f1..f54ee5a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/README.md b/README.md index 9b9ebc59..74b1067f 100644 --- a/README.md +++ b/README.md @@ -469,7 +469,7 @@ Options: -Z, --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, [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 [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 Show input number and/or input filename before each message [default: auto] [possible values: auto, none, full, compact, minimal] diff --git a/src/app.rs b/src/app.rs index 5b364eb4..c479c86a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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 { diff --git a/src/main.rs b/src/main.rs index e425796b..ab56ce26 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ use std::num::NonZeroUsize; // local imports use hl::{ + app, datefmt::LinuxDateFormat, error::*, input::InputReference, @@ -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", @@ -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, @@ -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), }, });