summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/cli.rs
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-18 10:05:15 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-18 10:05:15 +0200
commitbcbde9fbb5bffe4e1334acc1270314517938cac5 (patch)
tree8a18820a32392fb4a8a132a27740299ac4849f84 /zellij-utils/src/cli.rs
parentdc067580f3df50bff17aee48fb330c164084c6bd (diff)
parent8c3bf215b7c56fb1254e55ac182233ac488f3113 (diff)
Merge branch 'main' of https://github.com/zellij-org/zellij into layout-path-506
Diffstat (limited to 'zellij-utils/src/cli.rs')
-rw-r--r--zellij-utils/src/cli.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
new file mode 100644
index 000000000..56e93edb3
--- /dev/null
+++ b/zellij-utils/src/cli.rs
@@ -0,0 +1,55 @@
+use crate::consts::{ZELLIJ_CONFIG_DIR_ENV, ZELLIJ_CONFIG_FILE_ENV};
+use crate::input::options::Options;
+use crate::setup::Setup;
+use serde::{Deserialize, Serialize};
+use std::path::PathBuf;
+use structopt::StructOpt;
+
+#[derive(StructOpt, Default, Debug, Clone, Serialize, Deserialize)]
+#[structopt(name = "zellij")]
+pub struct CliArgs {
+ /// Maximum panes on screen, caution: opening more panes will close old ones
+ #[structopt(long)]
+ pub max_panes: Option<usize>,
+
+ /// Change where zellij looks for layouts and plugins
+ #[structopt(long, parse(from_os_str))]
+ pub data_dir: Option<PathBuf>,
+
+ /// Run server listening at the specified socket path
+ #[structopt(long, parse(from_os_str))]
+ pub server: Option<PathBuf>,
+
+ /// Path to a layout yaml file
+ #[structopt(short, long, parse(from_os_str))]
+ pub layout: Option<PathBuf>,
+
+ /// Path to a layout yaml file
+ #[structopt(long, parse(from_os_str))]
+ pub layout_path: Option<PathBuf>,
+
+ /// Change where zellij looks for the configuration
+ #[structopt(short, long, env=ZELLIJ_CONFIG_FILE_ENV, parse(from_os_str))]
+ pub config: Option<PathBuf>,
+
+ /// Change where zellij looks for the configuration
+ #[structopt(long, env=ZELLIJ_CONFIG_DIR_ENV, parse(from_os_str))]
+ pub config_dir: Option<PathBuf>,
+
+ #[structopt(subcommand)]
+ pub option: Option<ConfigCli>,
+
+ #[structopt(short, long)]
+ pub debug: bool,
+}
+
+#[derive(Debug, StructOpt, Clone, Serialize, Deserialize)]
+pub enum ConfigCli {
+ /// Change the behaviour of zellij
+ #[structopt(name = "options")]
+ Options(Options),
+
+ /// Setup zellij and check its configuration
+ #[structopt(name = "setup")]
+ Setup(Setup),
+}