diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-03 15:09:58 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-03 15:09:58 +0800 |
| commit | 599b1b7d9f657ed9c36bdcbece8c771db4422bab (patch) | |
| tree | 494075dea778716316994e19d13bd94b8e5d9aab /scripts | |
| parent | 5b04d567c4ba88f3236218cf0f23b52bffdde1a4 (diff) | |
Add info command to display file details
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/completions/bash/completion_jv.sh | 10 | ||||
| -rw-r--r-- | scripts/completions/powershell/completion_jv.ps1 | 11 |
2 files changed, 19 insertions, 2 deletions
diff --git a/scripts/completions/bash/completion_jv.sh b/scripts/completions/bash/completion_jv.sh index 604fb8c..d6743e7 100644 --- a/scripts/completions/bash/completion_jv.sh +++ b/scripts/completions/bash/completion_jv.sh @@ -18,7 +18,7 @@ _jv_completion() { local base_commands="create init direct unstain account update \ sheet status here move mv docs exit use sheets accounts \ as make drop track hold throw login \ - jump align" + jump align info" # Subcommands - Account local account_commands="list as add remove movekey mvkey mvk genpub help" @@ -181,6 +181,14 @@ _jv_completion() { return 0 fi + # Completion info + if [[ "$subcmd" == "info" ]]; then + if [[ $cword -eq 2 ]]; then + COMPREPLY=($(compgen -f -- "$cur")) + fi + return 0 + fi + # aliases case "$subcmd" in "as") diff --git a/scripts/completions/powershell/completion_jv.ps1 b/scripts/completions/powershell/completion_jv.ps1 index 46a56cc..5027a35 100644 --- a/scripts/completions/powershell/completion_jv.ps1 +++ b/scripts/completions/powershell/completion_jv.ps1 @@ -16,7 +16,7 @@ Register-ArgumentCompleter -Native -CommandName jv -ScriptBlock { "create", "init", "direct", "unstain", "account", "update", "sheet", "status", "here", "move", "mv", "docs", "exit", "use", "sheets", "accounts", "as", "make", "drop", "track", "hold", "throw", "login", - "jump", "align" + "jump", "align", "info" ) # Account subcommands @@ -166,6 +166,15 @@ Register-ArgumentCompleter -Native -CommandName jv -ScriptBlock { return @() } + # Completion for info command + if ($subcmd -eq "info") { + if ($currentIndex -eq 2) { + # File completion for the file argument + return Get-ChildItem -Name -File -Path "." | Where-Object { $_ -like "$wordToComplete*" } + } + return @() + } + # Aliases completion switch ($subcmd) { "as" { |
