diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-11-05 16:42:10 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-11-05 16:42:10 +0800 |
| commit | bb980ee5d4ce9fe47f08fc120636ee9f5f66d54e (patch) | |
| tree | aa041020a53e0b2f09e112d9ead77f8c45c265ef /src/bin/jv.rs | |
| parent | 37592f1df3522c27ea514a89906f87498a946bc6 (diff) | |
Add shorthand aliases for common commands
- Add `accounts`, `as`, `make`, `drop` commands to jv - Add `members`
command to jvv with `-M` alias - Implement corresponding action handlers
for new commands
Diffstat (limited to 'src/bin/jv.rs')
| -rw-r--r-- | src/bin/jv.rs | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/src/bin/jv.rs b/src/bin/jv.rs index 8ccd843..508b561 100644 --- a/src/bin/jv.rs +++ b/src/bin/jv.rs @@ -13,7 +13,10 @@ use just_enough_vcs::{ SetUpstreamVaultActionResult, UpdateToLatestInfoResult, proc_update_to_latest_info_action, }, - sheet_actions::{MakeSheetActionResult, proc_make_sheet_action}, + sheet_actions::{ + DropSheetActionResult, MakeSheetActionResult, proc_drop_sheet_action, + proc_make_sheet_action, + }, }, constants::PORT, current::current_local_path, @@ -33,7 +36,10 @@ use just_enough_vcs::{ use just_enough_vcs_cli::{ data::compile_info::CompileInfo, utils::{ - input::confirm_hint_or, lang_selector::current_locales, md_colored::md, socket_addr_helper, + input::{confirm_hint, confirm_hint_or}, + lang_selector::current_locales, + md_colored::md, + socket_addr_helper, }, }; use rust_i18n::{set_locale, t}; @@ -136,6 +142,18 @@ enum JustEnoughVcsWorkspaceCommand { /// List all sheets Sheets, + + /// List all accounts + Accounts, + + /// Set current local workspace account + As(SetLocalWorkspaceAccountArgs), + + /// Make a new sheet + Make(SheetMakeArgs), + + /// Drop a sheet + Drop(SheetDropArgs), } #[derive(Parser, Debug)] @@ -609,7 +627,40 @@ async fn main() { }) .await; } - JustEnoughVcsWorkspaceCommand::Sheets => jv_sheet_list(SheetListArgs { help: false }).await, + JustEnoughVcsWorkspaceCommand::Sheets => { + jv_sheet_list(SheetListArgs { + help: false, + others: false, + all: false, + }) + .await + } + JustEnoughVcsWorkspaceCommand::Accounts => { + let user_dir = match UserDirectory::current_doc_dir() { + Some(dir) => dir, + None => { + eprintln!("{}", t!("jv.fail.account.no_user_dir")); + return; + } + }; + jv_account_list(user_dir, AccountListArgs { help: false }).await + } + JustEnoughVcsWorkspaceCommand::As(args) => { + let user_dir = match UserDirectory::current_doc_dir() { + Some(dir) => dir, + None => { + eprintln!("{}", t!("jv.fail.account.no_user_dir")); + return; + } + }; + jv_account_as(user_dir, args).await + } + JustEnoughVcsWorkspaceCommand::Make(args) => { + jv_sheet_make(args).await; + } + JustEnoughVcsWorkspaceCommand::Drop(args) => { + jv_sheet_drop(args).await; + } } } |
