summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/jv.rs57
-rw-r--r--src/bin/jvv.rs25
2 files changed, 79 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;
+ }
}
}
diff --git a/src/bin/jvv.rs b/src/bin/jvv.rs
index 8dc9c88..38a5982 100644
--- a/src/bin/jvv.rs
+++ b/src/bin/jvv.rs
@@ -68,6 +68,10 @@ enum JustEnoughVcsVaultCommand {
// Short commands
#[command(alias = "-l", alias = "listen")]
ServiceListen(ListenArgs),
+
+ // List all members
+ #[command(alias = "-M", alias = "members")]
+ MemberList,
}
#[derive(Parser, Debug)]
@@ -300,6 +304,27 @@ async fn main() {
}
jvv_service_listen(listen_args).await;
}
+ JustEnoughVcsVaultCommand::MemberList => {
+ let vault_cfg = match VaultConfig::read().await {
+ Ok(cfg) => cfg,
+ Err(_) => {
+ eprintln!("{}", t!("jvv.fail.no_vault_here").trim());
+ return;
+ }
+ };
+
+ let vault = match Vault::init_current_dir(vault_cfg) {
+ Some(vault) => vault,
+ None => {
+ eprintln!(
+ "{}",
+ t!("jvv.fail.jvcs", err = "Failed to initialize vault")
+ );
+ return;
+ }
+ };
+ jvv_member_list(vault, MemberListArgs { help: false }).await;
+ }
}
}