From e58b67ce2ed839dd8cbd2dadabc6e092b0e0b96a Mon Sep 17 00:00:00 2001 From: Marcin Puc <5671049+tranzystorek-io@users.noreply.github.com> Date: Sun, 23 Jan 2022 20:59:03 +0100 Subject: chore(deps): update arg parsing to clap v3 (#1017) * Update arg parsing to clap v3 * Ignore shell argument case --- zellij-utils/src/cli.rs | 56 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'zellij-utils/src/cli.rs') diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs index 2c1aeba37..03bf8db4d 100644 --- a/zellij-utils/src/cli.rs +++ b/zellij-utils/src/cli.rs @@ -3,111 +3,111 @@ use crate::{ consts::{ZELLIJ_CONFIG_DIR_ENV, ZELLIJ_CONFIG_FILE_ENV}, input::options::CliOptions, }; +use clap::{Parser, Subcommand}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; -use structopt::StructOpt; -#[derive(StructOpt, Default, Debug, Clone, Serialize, Deserialize)] -#[structopt(name = "zellij")] +#[derive(Parser, Default, Debug, Clone, Serialize, Deserialize)] +#[clap(version, name = "zellij")] pub struct CliArgs { /// Maximum panes on screen, caution: opening more panes will close old ones - #[structopt(long)] + #[clap(long)] pub max_panes: Option, /// Change where zellij looks for layouts and plugins - #[structopt(long, parse(from_os_str))] + #[clap(long, parse(from_os_str))] pub data_dir: Option, /// Run server listening at the specified socket path - #[structopt(long, parse(from_os_str), hidden = true)] + #[clap(long, parse(from_os_str), hide = true)] pub server: Option, /// Specify name of a new session - #[structopt(long, short)] + #[clap(long, short)] pub session: Option, /// Name of a layout file in the layout directory - #[structopt(short, long, parse(from_os_str))] + #[clap(short, long, parse(from_os_str))] pub layout: Option, /// Path to a layout yaml file - #[structopt(long, parse(from_os_str))] + #[clap(long, parse(from_os_str))] pub layout_path: Option, /// Change where zellij looks for the configuration file - #[structopt(short, long, env=ZELLIJ_CONFIG_FILE_ENV, parse(from_os_str))] + #[clap(short, long, env = ZELLIJ_CONFIG_FILE_ENV, parse(from_os_str))] pub config: Option, /// Change where zellij looks for the configuration directory - #[structopt(long, env=ZELLIJ_CONFIG_DIR_ENV, parse(from_os_str))] + #[clap(long, env = ZELLIJ_CONFIG_DIR_ENV, parse(from_os_str))] pub config_dir: Option, - #[structopt(subcommand)] + #[clap(subcommand)] pub command: Option, - #[structopt(short, long)] + #[clap(short, long)] pub debug: bool, } -#[derive(Debug, StructOpt, Clone, Serialize, Deserialize)] +#[derive(Debug, Subcommand, Clone, Serialize, Deserialize)] pub enum Command { /// Change the behaviour of zellij - #[structopt(name = "options")] + #[clap(name = "options")] Options(CliOptions), /// Setup zellij and check its configuration - #[structopt(name = "setup")] + #[clap(name = "setup")] Setup(Setup), /// Explore existing zellij sessions - #[structopt(flatten)] + #[clap(flatten)] Sessions(Sessions), } -#[derive(Debug, StructOpt, Clone, Serialize, Deserialize)] +#[derive(Debug, Subcommand, Clone, Serialize, Deserialize)] pub enum SessionCommand { /// Change the behaviour of zellij - #[structopt(name = "options")] + #[clap(name = "options")] Options(CliOptions), } -#[derive(Debug, StructOpt, Clone, Serialize, Deserialize)] +#[derive(Debug, Subcommand, Clone, Serialize, Deserialize)] pub enum Sessions { /// List active sessions - #[structopt(alias = "ls")] + #[clap(alias = "ls")] ListSessions, /// Attach to session - #[structopt(alias = "a")] + #[clap(alias = "a")] Attach { /// Name of the session to attach to. session_name: Option, /// Create a session if one does not exist. - #[structopt(short, long)] + #[clap(short, long)] create: bool, /// Number of the session index in the active sessions ordered creation date. - #[structopt(long)] + #[clap(long)] index: Option, /// Change the behaviour of zellij - #[structopt(subcommand, name = "options")] + #[clap(subcommand, name = "options")] options: Option, }, /// Kill the specific session - #[structopt(alias = "k")] + #[clap(alias = "k")] KillSession { /// Name of target session target_session: Option, }, /// Kill all sessions - #[structopt(alias = "ka")] + #[clap(alias = "ka")] KillAllSessions { /// Automatic yes to prompts - #[structopt(short, long)] + #[clap(short, long)] yes: bool, }, } -- cgit v1.2.3