diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-04-27 09:23:52 +0200 |
|---|---|---|
| committer | a-kenji <aks.kenji@protonmail.com> | 2021-04-27 21:38:26 +0200 |
| commit | 77e0b5e0d7a44e9a23751eda8a61aed845974686 (patch) | |
| tree | 077f56665a33c519493d242e245a91caa3bcced1 /src/cli.rs | |
| parent | fix(ci): formatting tweak (diff) | |
| download | sl0ppij-77e0b5e0d7a44e9a23751eda8a61aed845974686.tar.gz sl0ppij-77e0b5e0d7a44e9a23751eda8a61aed845974686.tar.xz sl0ppij-77e0b5e0d7a44e9a23751eda8a61aed845974686.zip | |
Config Loading
* Configuration is now handled in this order:
--config flag
ZELLIJ_CONFIG_FILE env
get_default_config_dir() (directories-next)
HOME/.config/zellij (for mac convenience)
SYSTEM_DEFAULT_CONFIG_DIR (for distributions to specify sensible
defaults ontop of zellij)
from assets
* Fix default.yaml file
* Move default.yaml file to assets directory
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -1,9 +1,7 @@ +use super::common::utils::consts::{ZELLIJ_CONFIG_DIR_ENV, ZELLIJ_CONFIG_FILE_ENV}; 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 { @@ -32,9 +30,13 @@ pub struct CliArgs { pub layout: Option<PathBuf>, /// Change where zellij looks for the configuration - #[structopt(short, long, env=ZELLIJ_CONFIG_ENV)] + #[structopt(short, long, env=ZELLIJ_CONFIG_FILE_ENV)] pub config: Option<PathBuf>, + /// Change where zellij looks for the configuration + #[structopt(long, env=ZELLIJ_CONFIG_DIR_ENV)] + pub config_dir: Option<PathBuf>, + #[structopt(subcommand)] pub option: Option<ConfigCli>, @@ -47,11 +49,19 @@ pub enum ConfigCli { /// Change the behaviour of zellij #[structopt(name = "option")] Config { - #[structopt(long)] /// Disables loading of configuration file at default location + #[structopt(long)] clean: bool, }, #[structopt(name = "generate-completion")] GenerateCompletion { shell: String }, + + #[structopt(name = "setup")] + Setup { + /// Disables loading of configuration file at default location + /// Dump the default configuration file to stdout + #[structopt(long)] + dump_config: bool, + }, } |
