From ace4b9aa104f80623b0ed278e2d9c2cc97d1d37f Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Thu, 21 Apr 2022 19:53:02 -0600 Subject: [PATCH] Add environment fallback for config path + FORMATY_CONFIG is the fallback for the optional config path + If -c is not provided, we go to the system config --- README.md | 16 ++++++++-------- src/main.rs | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a8ed35d..bed78b5 100644 --- a/README.md +++ b/README.md @@ -64,20 +64,20 @@ Formaty 0.1.0 Arbitrary Binary Data Formatting USAGE: -formaty [OPTIONS] [data]... + formaty [OPTIONS] [data]... FLAGS: --h, --help Prints help information --V, --version Prints version information + -h, --help Prints help information + -V, --version Prints version information OPTIONS: --b, --base Base of the input values --c, --config Path to the format config --i, --input_type Input data type [default: array] + -b, --base Base of the input values + -c, --config Path to the format config [env: FORMATY_CONFIG=] + -i, --input_type Input data type [default: array] ARGS: - Format to parse data as -... Raw data + Format to parse data as + ... Raw data ``` ## License diff --git a/src/main.rs b/src/main.rs index 1c272ad..9f58b65 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,7 @@ pub struct Args { #[structopt( short = "c", long = "config", + env = "FORMATY_CONFIG", parse(from_os_str), help = "Path to the format config" )]