chore: add help to cli options (#1839)

This commit is contained in:
Jae-Heon Ji 2022-10-24 00:46:01 +09:00 committed by GitHub
parent 75801bdb0e
commit 2fc6cefb95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,14 +127,23 @@ pub enum Sessions {
/// Run a command in a new pane /// Run a command in a new pane
#[clap(visible_alias = "r")] #[clap(visible_alias = "r")]
Run { Run {
/// Command to run
#[clap(last(true), required(true))] #[clap(last(true), required(true))]
command: Vec<String>, command: Vec<String>,
/// Direction to open the new pane in
#[clap(short, long, value_parser, conflicts_with("floating"))] #[clap(short, long, value_parser, conflicts_with("floating"))]
direction: Option<Direction>, direction: Option<Direction>,
/// Change the working directory of the new pane
#[clap(long, value_parser)] #[clap(long, value_parser)]
cwd: Option<PathBuf>, cwd: Option<PathBuf>,
/// Open the new pane in floating mode
#[clap(short, long, value_parser, default_value("false"), takes_value(false))] #[clap(short, long, value_parser, default_value("false"), takes_value(false))]
floating: bool, floating: bool,
/// Name of the new pane
#[clap(short, long, value_parser)] #[clap(short, long, value_parser)]
name: Option<String>, name: Option<String>,
}, },
@ -142,10 +151,16 @@ pub enum Sessions {
#[clap(visible_alias = "e")] #[clap(visible_alias = "e")]
Edit { Edit {
file: PathBuf, file: PathBuf,
/// Open the file in the specified line number
#[clap(short, long, value_parser)] #[clap(short, long, value_parser)]
line_number: Option<usize>, line_number: Option<usize>,
/// Direction to open the new pane in
#[clap(short, long, value_parser, conflicts_with("floating"))] #[clap(short, long, value_parser, conflicts_with("floating"))]
direction: Option<Direction>, direction: Option<Direction>,
/// Open the new pane in floating mode
#[clap(short, long, value_parser, default_value("false"), takes_value(false))] #[clap(short, long, value_parser, default_value("false"), takes_value(false))]
floating: bool, floating: bool,
}, },
@ -180,9 +195,11 @@ pub enum CliAction {
/// Change the location of the focused pane in the specified direction /// Change the location of the focused pane in the specified direction
/// [right|left|up|down] /// [right|left|up|down]
MovePane { direction: Direction }, MovePane { direction: Direction },
/// Dumps the pane scrollback to a file /// Dump the focused pane to a file
DumpScreen { DumpScreen {
path: PathBuf, path: PathBuf,
/// Dump the pane with full scrollback
#[clap(short, long, value_parser, default_value("false"), takes_value(false))] #[clap(short, long, value_parser, default_value("false"), takes_value(false))]
full: bool, full: bool,
}, },
@ -211,24 +228,38 @@ pub enum CliAction {
/// Open a new pane in the specified direction [right|down] /// Open a new pane in the specified direction [right|down]
/// If no direction is specified, will try to use the biggest available space. /// If no direction is specified, will try to use the biggest available space.
NewPane { NewPane {
/// Direction to open the new pane in
#[clap(short, long, value_parser, conflicts_with("floating"))] #[clap(short, long, value_parser, conflicts_with("floating"))]
direction: Option<Direction>, direction: Option<Direction>,
#[clap(last(true))] #[clap(last(true))]
command: Vec<String>, command: Vec<String>,
/// Change the working directory of the new pane
#[clap(long, value_parser)] #[clap(long, value_parser)]
cwd: Option<PathBuf>, cwd: Option<PathBuf>,
/// Open the new pane in floating mode
#[clap(short, long, value_parser, default_value("false"), takes_value(false))] #[clap(short, long, value_parser, default_value("false"), takes_value(false))]
floating: bool, floating: bool,
/// Name of the new pane
#[clap(short, long, value_parser)] #[clap(short, long, value_parser)]
name: Option<String>, name: Option<String>,
}, },
/// Open the specified file in a new zellij pane with your default EDITOR /// Open the specified file in a new zellij pane with your default EDITOR
Edit { Edit {
file: PathBuf, file: PathBuf,
/// Direction to open the new pane in
#[clap(short, long, value_parser, conflicts_with("floating"))] #[clap(short, long, value_parser, conflicts_with("floating"))]
direction: Option<Direction>, direction: Option<Direction>,
/// Open the file in the specified line number
#[clap(short, long, value_parser)] #[clap(short, long, value_parser)]
line_number: Option<usize>, line_number: Option<usize>,
/// Open the new pane in floating mode
#[clap(short, long, value_parser, default_value("false"), takes_value(false))] #[clap(short, long, value_parser, default_value("false"), takes_value(false))]
floating: bool, floating: bool,
}, },
@ -258,10 +289,15 @@ pub enum CliAction {
UndoRenameTab, UndoRenameTab,
/// Create a new tab, optionally with a specified tab layout and name /// Create a new tab, optionally with a specified tab layout and name
NewTab { NewTab {
/// Layout to use for the new tab
#[clap(short, long, value_parser)] #[clap(short, long, value_parser)]
layout: Option<PathBuf>, layout: Option<PathBuf>,
/// Name of the new tab
#[clap(short, long, value_parser)] #[clap(short, long, value_parser)]
name: Option<String>, name: Option<String>,
/// Change the working directory of the new tab
#[clap(short, long, value_parser, requires("layout"))] #[clap(short, long, value_parser, requires("layout"))]
cwd: Option<PathBuf>, cwd: Option<PathBuf>,
}, },