aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-04-21 08:58:38 +0200
committera-kenji <aks.kenji@protonmail.com>2021-04-21 09:03:46 +0200
commit2c12e8ff8324b3ebaa10ac8162af09f5da295e1b (patch)
tree674d5988c5ca0a34e6931798467fed61b45da3cf /src/cli.rs
parentfix(release): beta tag breaks cargo install (diff)
downloadsl0ppij-2c12e8ff8324b3ebaa10ac8162af09f5da295e1b.tar.gz
sl0ppij-2c12e8ff8324b3ebaa10ac8162af09f5da295e1b.tar.xz
sl0ppij-2c12e8ff8324b3ebaa10ac8162af09f5da295e1b.zip
Change Config To Flag (#290)
This changes the `config` subcommand to a config flag. Add option subcommand for now, for the clearing of default path. Add `ZELLIJ_CONFIG` environment variable. The configuration locations are now as follows: * `--config` flag * `ZELLIJ_CONFIG` environment variable * default config location in that order.
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 43047dd3..008fb28c 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1,6 +1,9 @@
use std::path::PathBuf;
use structopt::StructOpt;
+// TODO add to consts.rs
+const ZELLIJ_CONFIG_ENV: &str = "ZELLIJ_CONFIG";
+
#[derive(StructOpt, Default, Debug)]
#[structopt(name = "zellij")]
pub struct CliArgs {
@@ -28,8 +31,12 @@ pub struct CliArgs {
#[structopt(short, long)]
pub layout: Option<PathBuf>,
+ /// Change where zellij looks for the configuration
+ #[structopt(short, long, env=ZELLIJ_CONFIG_ENV)]
+ pub config: Option<PathBuf>,
+
#[structopt(subcommand)]
- pub config: Option<ConfigCli>,
+ pub option: Option<ConfigCli>,
#[structopt(short, long)]
pub debug: bool,
@@ -37,10 +44,9 @@ pub struct CliArgs {
#[derive(Debug, StructOpt)]
pub enum ConfigCli {
- /// Path to the configuration yaml file
- #[structopt(alias = "c")]
+ /// Change the behaviour of zellij
+ #[structopt(name = "option")]
Config {
- path: Option<PathBuf>,
#[structopt(long)]
/// Disables loading of configuration file at default location
clean: bool,