remux/src/help.rs

102 lines
2.2 KiB
Rust
Raw Normal View History

2024-01-23 16:45:58 -05:00
use pico_args::Arguments;
use crate::error;
2024-02-04 16:11:32 -05:00
use crate::VERSION;
2024-01-23 16:45:58 -05:00
pub fn help(pargs: &mut Arguments) {
let topic = pargs.subcommand().unwrap();
match topic.as_deref() {
2024-03-03 22:48:20 -05:00
None =>
println!("remux v{VERSION}
Valerie Wolfe <sleeplessval@gmail.com>
A command wrapper for tmux written in Rust.
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
usage: remux <command> [<args>]
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
commands:
help Show help text for remux or a specific command
attach Attach to an existing tmux session
detach Detach clients from a tmux session
has Check if a tmux session exists
list Pretty-print all tmux sessions
new Create a new tmux session
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
Use 'remux help <command>' to see detailed help text for each command."),
2024-01-23 16:45:58 -05:00
Some("a" | "attach")
2024-03-03 22:48:20 -05:00
=>
println!("remux attach
Attach to an existing session.
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
usage: remux attach [flags] <session> [window]
remux a [flags] <session> [window]
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
args:
<session> The session to attach to
[window] Optionally focus a window in the given session
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
flags:
-d, --detach Detach other attached clients from the session
-n, --nest Attach the session inside another session.
-r, --readonly Attach the session as read-only"),
2024-01-23 16:45:58 -05:00
Some("d" | "detach")
2024-03-03 22:48:20 -05:00
=>
println!("remux detach
Detach all clients from a session.
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
usage: remux detach <session>
remux d <session>
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
args:
<session> The session name to detach clients from"),
2024-01-23 16:45:58 -05:00
Some("has")
2024-03-03 22:48:20 -05:00
=>
println!("remux has
Check if the target session exists.
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
usage: remux has [flags] <session>
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
args:
<session> The session to check for
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
flags:
-q, --quiet Display no text; exit code only"),
2024-01-23 16:45:58 -05:00
Some("l" | "ls" | "list")
2024-03-03 22:48:20 -05:00
=>
println!("remux list
Pretty-print all tmux sessions.
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
usage: remux list
remux ls
remux l"),
2024-01-23 16:45:58 -05:00
Some("n" | "new")
2024-03-03 22:48:20 -05:00
=>
println!("remux new
Create a new tmux session.
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
usage: remux new [flags] <title> [command]
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
args:
<title> The title of the new session
[command] The shell command to run
2024-01-23 16:45:58 -05:00
2024-03-03 22:48:20 -05:00
flags:
-n, --nest Create the session inside another session.
-t, --target <dir> Sets the target directory for the new session."),
2024-01-23 16:45:58 -05:00
// not found
_ => error::no_help(topic.unwrap())
}
}
2024-02-04 16:11:32 -05:00
pub fn version() {
println!("remux v{VERSION}");
}