summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-05-08 16:11:41 -0500
committerToby Vincent <tobyv13@gmail.com>2023-05-08 16:15:59 -0500
commitff1be6b6fe3042b74b5b2df9b867f0c195a5bd35 (patch)
tree242e5a5b923364e15b69c9e22f0f464f37c974d5
parentde5b70c5426311ce887e757c7397bed9107c83c0 (diff)
feat: move path gen out of --tmux as --sessions
-rw-r--r--src/config.rs14
-rw-r--r--src/main.rs6
2 files changed, 15 insertions, 5 deletions
diff --git a/src/config.rs b/src/config.rs
index d961f50..f8160af 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -15,9 +15,15 @@ pub struct Config {
/// Add arbitrary directories
///
/// Directories added by this flag are still filtered and sorted based on supplied options.
- #[arg(long = "project", short = 'P')]
+ #[arg(short = 'P', long = "project")]
pub projects: Vec<PathBuf>,
+ /// Add any current tmux session's paths to output.
+ ///
+ /// Uses the tmux session's `session_path`.
+ #[arg(short = 'T', long = "sessions")]
+ pub tmux_sessions: bool,
+
#[command(flatten)]
pub verbosity: Verbosity,
}
@@ -65,9 +71,11 @@ pub struct Projects {
#[arg(long, short)]
pub git: bool,
- /// Add current tmux session directories.
+ /// Use existing tmux sessions for project timestamps
///
- /// Uses last attached time as the timestamp.
+ /// Note: This only used for sorting projects using `session_last_attached` (or
+ /// `session_created` if not yet attached). For adding existing tmux session's paths to the
+ /// ouput, see `-T|--sessions`.
#[arg(long, short)]
pub tmux: bool,
}
diff --git a/src/main.rs b/src/main.rs
index 383411b..78583c2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -19,8 +19,10 @@ fn main() -> Result<()> {
projects.extend(search);
}
- if let Ok(sessions) = Tmux::sessions() {
- projects.extend(sessions)
+ if config.tmux_sessions {
+ if let Ok(sessions) = Tmux::sessions() {
+ projects.extend(sessions)
+ }
}
Ok(projects.write(std::io::stdout())?)