renamed 'root' command to 'path'

This commit is contained in:
Valerie Wolfe 2024-06-10 12:03:40 -04:00
parent 1320b6f122
commit 0fc6cd66c6
4 changed files with 14 additions and 10 deletions

View file

@ -48,9 +48,9 @@ tmux swi -t foo
rmux s foo rmux s foo
# cd to session path # cd to session path
tmux run 'printf "#{session_path}" > /tmp/tmux_root' tmux run 'printf "#{session_path}" > /tmp/tmux_path'
cd `cat /tmp/tmux_root` cd `cat /tmp/tmux_path`
cd `rmux root` cd `rmux p`
``` ```

View file

@ -9,7 +9,7 @@ use tmux_interface::{
use crate::{ error, flag, util }; use crate::{ error, flag, util };
const TMP_ROOT: &str = "/tmp/remux_root"; const TMP_ROOT: &str = "/tmp/remux_path";
pub fn switch(pargs: &mut Arguments) { pub fn switch(pargs: &mut Arguments) {
util::terminal_enforce(); util::terminal_enforce();
@ -36,8 +36,8 @@ pub fn switch(pargs: &mut Arguments) {
.output().ok(); .output().ok();
} }
pub fn root() { pub fn path() {
util::session_enforce("root"); util::session_enforce("path");
let exec = commands::Run::new().shell_command("printf '#{session_path}' > ".to_string() + TMP_ROOT); let exec = commands::Run::new().shell_command("printf '#{session_path}' > ".to_string() + TMP_ROOT);
Tmux::new() Tmux::new()

View file

@ -23,6 +23,9 @@ commands:
list Pretty-print all tmux sessions list Pretty-print all tmux sessions
new Create a new tmux session new Create a new tmux session
path print session path (session)
switch switch to another session (session)
Use 'remux help <command>' to see detailed help text for each command. Use 'remux help <command>' to see detailed help text for each command.
help topics: help topics:
@ -100,11 +103,12 @@ flags:
Some("root") Some("root")
=> =>
println!("remux root println!("remux path
Print the session path (#{{session_path}}) to standard output. Print the session path (#{{session_path}}) to standard output.
Must be run from inside a session. Must be run from inside a session.
usage: remux root"), usage: remux path
remux p"),
Some("s" | "switch") Some("s" | "switch")
=> =>

View file

@ -60,8 +60,8 @@ fn main() {
Some("n" | "new") Some("n" | "new")
=> command::share::new(&mut args), => command::share::new(&mut args),
Some("root") Some("p" | "path")
=> command::session::root(), => command::session::path(),
Some("s" | "switch") Some("s" | "switch")
=> command::session::switch(&mut args), => command::session::switch(&mut args),