summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-12-01 11:42:53 +0800
committer魏曹先生 <1992414357@qq.com>2025-12-01 11:42:53 +0800
commit28ea3c189dd1410125e86cf6b4f2d5e60a1104fd (patch)
tree1ef3d1d40ec44897bcf58d35b6e1648a88ddc44b /src/bin
parent44ade3988ecf6bbedb93141a83fccfbf38753493 (diff)
Add completion helpers for workspace info
- Rename HistoryIpAddress to GetHistoryIpAddress for consistency - Add commands to get workspace directory, current account, upstream address, and current sheet
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/jv.rs37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/bin/jv.rs b/src/bin/jv.rs
index be0ec2d..8ad929d 100644
--- a/src/bin/jv.rs
+++ b/src/bin/jv.rs
@@ -199,7 +199,19 @@ enum JustEnoughVcsWorkspaceCommand {
// Completion Helpers
#[command(name = "_ip_history")]
- HistoryIpAddress,
+ GetHistoryIpAddress,
+
+ #[command(name = "_workspace_dir")]
+ GetWorkspaceDir,
+
+ #[command(name = "_account")]
+ GetCurrentAccount,
+
+ #[command(name = "_upstream")]
+ GetCurrentUpstream,
+
+ #[command(name = "_sheet")]
+ GetCurrentSheet,
}
#[derive(Parser, Debug)]
@@ -1088,6 +1100,29 @@ async fn main() {
.iter()
.for_each(|ip| println!("{}", ip));
}
+ JustEnoughVcsWorkspaceCommand::GetWorkspaceDir => {
+ if let Some(local_dir) = current_local_path() {
+ println!("{}", local_dir.display())
+ };
+ }
+ JustEnoughVcsWorkspaceCommand::GetCurrentAccount => {
+ if let Ok(local_config) = LocalConfig::read().await {
+ println!("{}", local_config.current_account())
+ };
+ }
+ JustEnoughVcsWorkspaceCommand::GetCurrentUpstream => {
+ if let Ok(local_config) = LocalConfig::read().await {
+ println!("{}", local_config.upstream_addr())
+ };
+ }
+ JustEnoughVcsWorkspaceCommand::GetCurrentSheet => {
+ if let Ok(local_config) = LocalConfig::read().await {
+ println!(
+ "{}",
+ local_config.sheet_in_use().clone().unwrap_or_default()
+ )
+ };
+ }
}
}