diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-11-17 17:42:36 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-11-17 17:42:36 +0800 |
| commit | 1804e265b4b096bc1c2eb08869e33299ff11e93c (patch) | |
| tree | a68cbd24a4e221b64e213c3584fbc384a4d596e4 /scripts | |
| parent | 2fc64079167a08f41fe4900ce3a3dbd703e2c7a6 (diff) | |
Add login command combining account setup and vault connection
The new `jv login` command streamlines the process of setting up a
workspace by combining account selection, vault connection, and initial
sync into a single operation.
- Add completion support for login command - Update help documentation
in both English and Chinese - Add confirmation prompt for login
operation
Diffstat (limited to 'scripts')
| -rw-r--r--[-rwxr-xr-x] | scripts/completion_jv.sh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/scripts/completion_jv.sh b/scripts/completion_jv.sh index 0532bad..51bd242 100755..100644 --- a/scripts/completion_jv.sh +++ b/scripts/completion_jv.sh @@ -14,7 +14,7 @@ _jv_completion() { local subsubcmd="${words[2]}" # Subcommands - local base_commands="create init direct unstain account update sheet status here import export in out move mv docs exit use sheets accounts as make drop track hold throw" + local base_commands="create init direct unstain account update sheet status here import export in out move mv docs exit use sheets accounts as make drop track hold throw login" # Subcommands - Account local account_commands="list as add remove movekey mvkey mvk help" @@ -87,6 +87,30 @@ _jv_completion() { return 0 fi + # Completion login + if [[ "$subcmd" == "login" ]]; then + if [[ $cword -eq 2 ]]; then + local accounts + accounts=$($cmd account list --raw 2>/dev/null) + COMPREPLY=($(compgen -W "$accounts" -- "$cur")) + elif [[ $cword -eq 3 ]]; then + local ip_history + ip_history=$($cmd _ip_history 2>/dev/null) + COMPREPLY=($(compgen -W "$ip_history" -- "$cur")) + fi + return 0 + fi + + # Completion direct + if [[ "$subcmd" == "direct" ]]; then + if [[ $cword -eq 2 ]]; then + local ip_history + ip_history=$($cmd _ip_history 2>/dev/null) + COMPREPLY=($(compgen -W "$ip_history" -- "$cur")) + fi + return 0 + fi + # aliases case "$subcmd" in "as") |
