vnetod/src/cli.rs

65 lines
1.9 KiB
Rust

//! Copyright (C) 2022, Dmitriy Pleshevskiy <dmitriy@pleshevski.ru>
//!
//! vnetod is free software: you can redistribute it and/or modify
//! it under the terms of the GNU General Public License as published by
//! the Free Software Foundation, either version 3 of the License, or
//! (at your option) any later version.
//!
//! vnetod is distributed in the hope that it will be useful,
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//! GNU General Public License for more details.
//!
//! You should have received a copy of the GNU General Public License
//! along with vnetod. If not, see <https://www.gnu.org/licenses/>.
//!
pub mod switch;
use std::path::PathBuf;
use clap::Parser;
#[derive(Parser)]
#[clap(
author,
version,
about = "\
Dotenv state switcher
---------------------------------------------------------------------
vnetod Copyright (C) 2022 Dmitriy Pleshevskiy <dmitriy@pleshevski.ru>
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions;
---------------------------------------------------------------------
"
)]
pub struct Args {
#[clap(
short = 'f',
long,
default_value = ".env",
help = "Change source file with environment variables"
)]
pub file: PathBuf,
#[clap(
short = 'o',
long,
help = "Change output file with modified environment variables. It uses `file` argument by default if the output is not specified"
)]
pub output: Option<PathBuf>,
#[clap(
long,
help = "Writes modified environment variables to stdout instead of a file. `Output` argument will be ignored."
)]
pub dry_run: bool,
#[clap(
value_parser,
help = "Environment varible sections that will be enabled"
)]
pub sections: Vec<String>,
}