Allow use of env vars instead of flags.
Author: asibahiCreated Apr 9, 2026Updated Apr 9, 2026
Hello.
This would be a small code change, but increase the usability of hexyl. clap already has the ability (gated in a env feature) to parse environment variables for certain flags, like for for example panels. This would be the entire diff for that, for example
diff --git a/Cargo.toml b/Cargo.toml
index 109fb95912..f4edcae1a0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@
[dependencies.clap]
version = "4"
-features = ["derive", "wrap_help"]
+features = ["derive", "wrap_help", "env"]
[dev-dependencies]
assert_cmd = "2.1"
diff --git a/src/main.rs b/src/main.rs
index eecf2b3cbe..dfd1ee567d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -161,7 +161,7 @@
/// display the maximum number of hex data panels based on the current
/// terminal width. By default, hexyl will show two panels, unless the
/// terminal is not wide enough for that.
- #[arg(long, value_name("N"))]
+ #[arg(long, value_name("N"), env="HEXYL_PANELS")]
panels: Option<String>,
/// Number of bytes/octets that should be grouped together. You can use theSource: sharkdp/hexyl