From 97089d19a4b339a622d78e48a41f1d67273752fd Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 22 Nov 2025 20:16:14 +0800 Subject: Add account key generation and public key export features - Add `--keygen` flag to `account add` for automatic ED25519 key generation - Add `account genpub` command to export public keys - Update help documentation in both English and Chinese - Extend shell completion for new commands - Add error handling for OpenSSL operations --- scripts/completion_jv.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) mode change 100755 => 100644 scripts/completion_jv.sh (limited to 'scripts') diff --git a/scripts/completion_jv.sh b/scripts/completion_jv.sh old mode 100755 new mode 100644 index 69614ce..43c8f70 --- a/scripts/completion_jv.sh +++ b/scripts/completion_jv.sh @@ -22,7 +22,7 @@ _jv_completion() { jump align" # Subcommands - Account - local account_commands="list as add remove movekey mvkey mvk help" + local account_commands="list as add remove movekey mvkey mvk genpub help" # Subcommands - Sheet local sheet_commands="list use exit make drop help" @@ -44,16 +44,25 @@ _jv_completion() { fi case "$subsubcmd" in - "as"|"remove"|"mvkey"|"mvk"|"movekey") + "as"|"remove"|"mvkey"|"mvk"|"movekey"|"genpub") if [[ $cword -eq 3 ]]; then # Use jv account list --raw local accounts accounts=$($cmd account list --raw 2>/dev/null) COMPREPLY=($(compgen -W "$accounts" -- "$cur")) - elif [[ $cword -eq 4 && ("$subsubcmd" == "mvkey" || "$subsubcmd" == "mvk" || "$subsubcmd" == "movekey") ]]; then + elif [[ $cword -eq 4 && ("$subsubcmd" == "mvkey" || "$subsubcmd" == "mvk" || "$subsubcmd" == "movekey" || "$subsubcmd" == "genpub") ]]; then COMPREPLY=($(compgen -f -- "$cur")) fi ;; + "add") + if [[ $cword -eq 3 ]]; then + # No completion for account name, let user type it + COMPREPLY=() + elif [[ $cword -eq 4 && "$cur" == -* ]]; then + # Complete --keygen option + COMPREPLY=($(compgen -W "--keygen" -- "$cur")) + fi + ;; "-"|"rm") if [[ $cword -eq 3 ]]; then local accounts -- cgit