diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-29 15:28:04 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-10-29 15:28:04 +0800 |
| commit | fdffd0d081465fa4d08645f7e1b546e1addb2ef9 (patch) | |
| tree | 194f55dc4c74a69fdc9116f5ffd6e769b9bd98cd /src/bin/jvv.rs | |
| parent | 40507c8e3b5751cd0488ae0bdcf11909eeff520d (diff) | |
Add confirmation options and alias commands
- Add -C/--confirm flags to skip confirmation for direct/unstain
commands - Add command aliases for account and vault subcommands
(+/-/ls) - Improve error handling with better error messages - Implement
unstain command functionality - Add port option to vault listen command
- Refactor error handling to use centralized function
Diffstat (limited to 'src/bin/jvv.rs')
| -rw-r--r-- | src/bin/jvv.rs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/bin/jvv.rs b/src/bin/jvv.rs index f6fbeaa..57e9dbf 100644 --- a/src/bin/jvv.rs +++ b/src/bin/jvv.rs @@ -41,32 +41,42 @@ struct JustEnoughVcsVault { #[derive(Subcommand, Debug)] enum JustEnoughVcsVaultCommand { /// Get vault info in the current directory + #[command(alias = "-H")] Here(HereArgs), /// Create a new directory and initialize a vault + #[command(alias = "-c")] Create(CreateVaultArgs), /// Create a vault in the current directory + #[command(alias = "-i")] Init(InitVaultArgs), /// Member manage - #[command(subcommand)] + #[command(subcommand, alias = "-m")] Member(MemberManage), /// Manage service #[command(subcommand)] Service(ServiceManage), + + // Short commands + #[command(alias = "-l", alias = "listen")] + ServiceListen(ListenArgs), } #[derive(Subcommand, Debug)] enum MemberManage { /// Register a member to the vault + #[command(alias = "+")] Register(MemberRegisterArgs), /// Remove a member from the vault + #[command(alias = "-")] Remove(MemberRemoveArgs), /// List all members in the vault + #[command(alias = "ls")] List(MemberListArgs), /// Show help information @@ -144,6 +154,10 @@ struct ListenArgs { /// Disable logging #[arg(short, long)] no_log: bool, + + /// Custom port + #[arg(short, long)] + port: Option<u16>, } #[tokio::main] @@ -246,6 +260,14 @@ async fn main() { return; } }, + // Short commands + JustEnoughVcsVaultCommand::ServiceListen(listen_args) => { + if listen_args.help { + println!("{}", md(t!("jvv.service"))); + return; + } + jvv_service_listen(listen_args).await; + } } } @@ -595,7 +617,8 @@ async fn jvv_service_listen(args: ListenArgs) { ) } - match server_entry(current_vault).await { + let port = if let Some(port) = args.port { port } else { 0 }; + match server_entry(current_vault, port).await { Ok(_) => { info!("{}", t!("jvv.success.service.listen_done").trim()); } |
