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:
|
2024-03-14 15:00:58 -04:00
|
|
|
help Show help text for remux, a command, or a help topic.
|
2024-03-03 22:48:20 -05:00
|
|
|
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-06-10 09:29:18 -04:00
|
|
|
path print session path (session)
|
2024-06-06 09:49:58 -04:00
|
|
|
switch switch to another session (session)
|
2024-01-23 16:45:58 -05:00
|
|
|
|
2024-03-14 15:00:58 -04:00
|
|
|
Use 'remux help <command>' to see detailed help text for each command.
|
|
|
|
|
|
|
|
help topics:
|
|
|
|
env Environment variables"),
|
2024-01-23 16:45:58 -05:00
|
|
|
|
2024-03-14 14:24:07 -04:00
|
|
|
|
|
|
|
// COMMAND HELP
|
|
|
|
|
|
|
|
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.
|
2024-03-07 16:54:16 -05:00
|
|
|
-r, --read-only 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
|
|
|
|
2024-06-06 15:56:27 -04:00
|
|
|
Some("h" | "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-06-06 15:56:27 -04:00
|
|
|
rmux h [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-03-07 16:54:16 -05:00
|
|
|
remux n [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
|
|
|
|
2024-06-06 09:41:41 -04:00
|
|
|
Some("root")
|
|
|
|
=>
|
2024-06-10 09:29:18 -04:00
|
|
|
println!("remux path
|
2024-06-06 09:41:41 -04:00
|
|
|
Print the session path (#{{session_path}}) to standard output.
|
|
|
|
Must be run from inside a session.
|
|
|
|
|
2024-06-10 09:29:18 -04:00
|
|
|
usage: remux path
|
|
|
|
remux p"),
|
2024-06-06 09:41:41 -04:00
|
|
|
|
2024-03-08 10:23:02 -05:00
|
|
|
Some("s" | "switch")
|
|
|
|
=>
|
|
|
|
println!("remux switch
|
|
|
|
Switch to a different tmux session.
|
|
|
|
Must be run from inside a session.
|
|
|
|
|
|
|
|
usage: remux switch [flags] <title>
|
|
|
|
remux s [flags] <title>
|
|
|
|
|
|
|
|
args:
|
|
|
|
<title> The title of the session to switch to.
|
|
|
|
|
|
|
|
flags:
|
|
|
|
-r, --read-only Attach the target session as read-only."),
|
|
|
|
|
2024-03-14 14:24:07 -04:00
|
|
|
// TOPIC HELP
|
|
|
|
|
|
|
|
Some("env" | "vars")
|
|
|
|
=>
|
|
|
|
println!("remux environment variables
|
|
|
|
|
|
|
|
REMUX_ATTACH_SYMBOL
|
|
|
|
Changes the symbol displayed for attached sessions displayed
|
|
|
|
by the 'list' command.
|
2024-03-14 16:31:06 -04:00
|
|
|
Default: '*'
|
|
|
|
|
|
|
|
REMUX_NEW_WINDOW
|
|
|
|
Provides a default window name when creating a session with
|
|
|
|
the 'new' command, if not empty.
|
|
|
|
Default: ''"),
|
2024-03-14 14:24:07 -04:00
|
|
|
|
2024-06-06 09:49:58 -04:00
|
|
|
// not found
|
2024-01-23 16:45:58 -05:00
|
|
|
_ => error::no_help(topic.unwrap())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-04 16:11:32 -05:00
|
|
|
pub fn version() {
|
|
|
|
println!("remux v{VERSION}");
|
|
|
|
}
|
|
|
|
|