diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-20 22:31:41 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-20 22:32:14 +0800 |
| commit | ce77780ebcf548b0d823af7ae240364a56fa321a (patch) | |
| tree | 4f71b68f944b143c0e0af1010bf189719d6e834c /scripts/deploy/legacy_completions | |
| parent | ab6be7968b25afb57fc428695693484ad8576718 (diff) | |
Remove legacy jv and jvv binaries and related filesjvn_0.1.1
Diffstat (limited to 'scripts/deploy/legacy_completions')
4 files changed, 0 insertions, 667 deletions
diff --git a/scripts/deploy/legacy_completions/bash/completion_jv.sh b/scripts/deploy/legacy_completions/bash/completion_jv.sh deleted file mode 100755 index 364df9d..0000000 --- a/scripts/deploy/legacy_completions/bash/completion_jv.sh +++ /dev/null @@ -1,272 +0,0 @@ -#!/bin/bash -# The JustEnoughVCS CommandLine Completion - -_jv_completion() { - local cur prev words cword - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - words=("${COMP_WORDS[@]}") - cword=$COMP_CWORD - - # Current - local cmd="${words[0]}" - local subcmd="${words[1]}" - local subsubcmd="${words[2]}" - - # Subcommands - 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 info share" - - # Subcommands - Account - local account_commands="list as add remove movekey mvkey mvk genpub help" - - # Subcommands - Sheet - local sheet_commands="list use exit make drop help align" - - # Subcommands - Sheet - local sheet_commands="list use exit make drop help align" - - # Completion subcommands - if [[ $cword -eq 1 ]]; then - COMPREPLY=($(compgen -W "$base_commands" -- "$cur")) - return 0 - fi - - # Completion account - if [[ "$subcmd" == "account" || "$subcmd" == "acc" ]]; then - if [[ $cword -eq 2 ]]; then - COMPREPLY=($(compgen -W "$account_commands" -- "$cur")) - return 0 - fi - - case "$subsubcmd" in - "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" || "$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 - accounts=$($cmd account list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$accounts" -- "$cur")) - fi - ;; - esac - return 0 - fi - - # Completion sheet - if [[ "$subcmd" == "sheet" || "$subcmd" == "sh" ]]; then - if [[ $cword -eq 2 ]]; then - COMPREPLY=($(compgen -W "$sheet_commands" -- "$cur")) - return 0 - fi - - case "$subsubcmd" in - # Use jv sheet list --raw --all/--other - "use"|"drop") - if [[ $cword -eq 3 ]]; then - local sheets - sheets=$($cmd sheet list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$sheets" -- "$cur")) - fi - ;; - "make") - if [[ $cword -eq 3 ]]; then - local all_sheets - all_sheets=$($cmd sheet list --all --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$all_sheets" -- "$cur")) - fi - ;; - "align") - if [[ $cword -eq 3 ]]; then - local align_items="lost moved erased" - local unsolved_items - unsolved_items=$($cmd sheet align --unsolved --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$align_items $unsolved_items" -- "$cur")) - elif [[ $cword -eq 4 ]]; then - local item="${words[3]}" - local align_operations="" - local created_items - created_items=$($cmd sheet align --created --raw 2>/dev/null) - - if [[ "$item" == "lost" ]]; then - align_operations="confirm" - elif [[ "$item" == lost:* ]]; then - align_operations="confirm $created_items" - elif [[ "$item" == "moved" || "$item" == moved:* ]]; then - align_operations="local remote break" - elif [[ "$item" == "erased" || "$item" == erased:* ]]; then - align_operations="confirm" - else - align_operations="local remote confirm break $created_items" - fi - - COMPREPLY=($(compgen -W "$align_operations" -- "$cur")) - fi - ;; - esac - return 0 - fi - - # Completion align - if [[ "$subcmd" == "align" ]]; then - if [[ $cword -eq 2 ]]; then - local align_items="lost moved erased" - local unsolved_items - unsolved_items=$($cmd sheet align --unsolved --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$align_items $unsolved_items" -- "$cur")) - elif [[ $cword -eq 3 ]]; then - local item="${words[2]}" - local align_operations="" - local created_items - created_items=$($cmd sheet align --created --raw 2>/dev/null) - - if [[ "$item" == "lost" ]]; then - align_operations="confirm" - elif [[ "$item" == lost:* ]]; then - align_operations="confirm $created_items" - elif [[ "$item" == "moved" || "$item" == moved:* ]]; then - align_operations="local remote break" - elif [[ "$item" == "erased" || "$item" == erased:* ]]; then - align_operations="confirm" - else - align_operations="local remote confirm break $created_items" - fi - - COMPREPLY=($(compgen -W "$align_operations" -- "$cur")) - fi - return 0 - fi - - # Completion share - if [[ "$subcmd" == "share" ]]; then - if [[ $cword -eq 2 ]]; then - # First parameter: list, see, jv share list --raw results, or files - local share_list - share_list=$($cmd share list --raw 2>/dev/null) - local first_param_options="list see $share_list" - COMPREPLY=($(compgen -W "$first_param_options" -f -- "$cur")) - elif [[ $cword -eq 3 ]]; then - # Second parameter: depends on first parameter - local first_param="${words[2]}" - - if [[ "$first_param" == "list" ]]; then - # list -> nothing - COMPREPLY=() - elif [[ "$first_param" == "see" ]]; then - # see -> jv share list --raw results - local share_list - share_list=$($cmd share list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$share_list" -- "$cur")) - elif [[ "$first_param" == *"@"* ]]; then - # Contains "@" (shareid) -> show options - COMPREPLY=($(compgen -W "--safe --overwrite --skip --reject" -- "$cur")) - else - # File input -> show jv sheet list --all --raw results - local all_sheets - all_sheets=$($cmd sheet list --all --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$all_sheets" -- "$cur")) - fi - fi - # Third parameter: no 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 - - # Completion info - if [[ "$subcmd" == "info" ]]; then - if [[ $cword -eq 2 ]]; then - COMPREPLY=($(compgen -f -- "$cur")) - fi - return 0 - fi - - # aliases - case "$subcmd" in - "as") - if [[ $cword -eq 2 ]]; then - local accounts - accounts=$($cmd account list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$accounts" -- "$cur")) - fi - ;; - "use") - if [[ $cword -eq 2 ]]; then - local sheets - sheets=$($cmd sheet list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$sheets" -- "$cur")) - fi - ;; - "make") - if [[ $cword -eq 2 ]]; then - local all_sheets - all_sheets=$($cmd sheet list --all --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$all_sheets" -- "$cur")) - fi - ;; - "drop") - if [[ $cword -eq 2 ]]; then - local sheets - sheets=$($cmd sheet list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$sheets" -- "$cur")) - fi - ;; - "docs") - if [[ $cword -eq 2 ]]; then - local docs - docs=$($cmd docs list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$docs" -- "$cur")) - fi - ;; - "move"|"mv") - COMPREPLY=($(compgen -f -- "$cur")) - ;; - "track"|"hold"|"throw") - COMPREPLY=($(compgen -f -- "$cur")) - ;; - esac -} - -complete -F _jv_completion jv diff --git a/scripts/deploy/legacy_completions/bash/completion_jvv.sh b/scripts/deploy/legacy_completions/bash/completion_jvv.sh deleted file mode 100755 index ce5668b..0000000 --- a/scripts/deploy/legacy_completions/bash/completion_jvv.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# The JustEnoughVCS CommandLine Completion - -_jvv_completion() { - local cur prev words cword - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - words=("${COMP_WORDS[@]}") - cword=$COMP_CWORD - - # Current - local cmd="${words[0]}" - local subcmd="${words[1]}" - local subsubcmd="${words[2]}" - - # Subcommands - local base_commands="create init here member service listen members -c -i -H -m -l -M" - - # Subcommands - Member - local member_commands="register remove list help + - ls" - - # Subcommands - Service - local service_commands="listen help" - - # Completion subcommands - if [[ $cword -eq 1 ]]; then - COMPREPLY=($(compgen -W "$base_commands" -- "$cur")) - return 0 - fi - - # Completion member - if [[ "$subcmd" == "member" || "$subcmd" == "-m" ]]; then - if [[ $cword -eq 2 ]]; then - COMPREPLY=($(compgen -W "$member_commands" -- "$cur")) - return 0 - fi - - case "$subsubcmd" in - "remove"|"-") - if [[ $cword -eq 3 ]]; then - # Use jvv member list --raw - local members - members=$($cmd member list --raw 2>/dev/null) - COMPREPLY=($(compgen -W "$members" -- "$cur")) - fi - ;; - esac - return 0 - fi - - # Completion service - if [[ "$subcmd" == "service" ]]; then - if [[ $cword -eq 2 ]]; then - COMPREPLY=($(compgen -W "$service_commands" -- "$cur")) - return 0 - fi - return 0 - fi - - # aliases - case "$subcmd" in - "-m") - if [[ $cword -eq 2 ]]; then - COMPREPLY=($(compgen -W "$member_commands" -- "$cur")) - fi - ;; - "listen"|"-l") - # listen command has no arguments to complete - ;; - "members"|"-M") - # members command has no arguments to complete - ;; - esac -} - -# Register completion function -complete -F _jvv_completion jvv diff --git a/scripts/deploy/legacy_completions/powershell/completion_jv.ps1 b/scripts/deploy/legacy_completions/powershell/completion_jv.ps1 deleted file mode 100644 index 84ba01a..0000000 --- a/scripts/deploy/legacy_completions/powershell/completion_jv.ps1 +++ /dev/null @@ -1,250 +0,0 @@ -# The JustEnoughVCS CommandLine Completion - -Register-ArgumentCompleter -Native -CommandName jv -ScriptBlock { - param($wordToComplete, $commandAst, $cursorPosition) - - $words = $commandAst.CommandElements | ForEach-Object { $_.ToString() } - $currentIndex = $words.IndexOf($wordToComplete) - if ($currentIndex -lt 0) { $currentIndex = $words.Count } - - $cmd = "jv" - $subcmd = if ($words.Count -gt 1) { $words[1] } else { $null } - $subsubcmd = if ($words.Count -gt 2) { $words[2] } else { $null } - - # Base commands - $baseCommands = @( - "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", "info", "share" - ) - - # Account subcommands - $accountCommands = @("list", "as", "add", "remove", "movekey", "mvkey", "mvk", "genpub", "help") - - # Sheet subcommands - $sheetCommands = @("list", "use", "exit", "make", "drop", "help", "align") - - # Completion for main command - if ($currentIndex -eq 1) { - return $baseCommands | Where-Object { $_ -like "$wordToComplete*" } - } - - # Completion for account command - if ($subcmd -eq "account" -or $subcmd -eq "acc") { - if ($currentIndex -eq 2) { - return $accountCommands | Where-Object { $_ -like "$wordToComplete*" } - } - - switch ($subsubcmd) { - { @("as", "remove", "mvkey", "mvk", "movekey", "genpub") -contains $_ } { - if ($currentIndex -eq 3) { - $accounts = & $cmd account list --raw 2>$null - return $accounts | Where-Object { $_ -like "$wordToComplete*" } - } elseif ($currentIndex -eq 4 -and (@("mvkey", "mvk", "movekey", "genpub") -contains $subsubcmd)) { - # File completion for key files - return Get-ChildItem -Name -File -Path "." | Where-Object { $_ -like "$wordToComplete*" } - } - } - "add" { - if ($currentIndex -eq 3) { - # No completion for account name - return @() - } elseif ($currentIndex -eq 4 -and $wordToComplete.StartsWith("-")) { - # Complete --keygen option - if ("--keygen" -like "$wordToComplete*") { - return "--keygen" - } - } - } - { @("-", "rm") -contains $_ } { - if ($currentIndex -eq 3) { - $accounts = & $cmd account list --raw 2>$null - return $accounts | Where-Object { $_ -like "$wordToComplete*" } - } - } - } - return @() - } - - # Completion for sheet command - if ($subcmd -eq "sheet" -or $subcmd -eq "sh") { - if ($currentIndex -eq 2) { - return $sheetCommands | Where-Object { $_ -like "$wordToComplete*" } - } - - switch ($subsubcmd) { - { @("use", "drop") -contains $_ } { - if ($currentIndex -eq 3) { - $sheets = & $cmd sheet list --raw 2>$null - return $sheets | Where-Object { $_ -like "$wordToComplete*" } - } - } - "make" { - if ($currentIndex -eq 3) { - $allSheets = & $cmd sheet list --all --raw 2>$null - return $allSheets | Where-Object { $_ -like "$wordToComplete*" } - } - } - "align" { - if ($currentIndex -eq 3) { - $alignItems = @("lost", "moved", "erased") - $unsolvedItems = & $cmd sheet align --unsolved --raw 2>$null - $completions = $alignItems + $unsolvedItems - return $completions | Where-Object { $_ -like "$wordToComplete*" } - } elseif ($currentIndex -eq 4) { - $item = $words[3] - $alignOperations = @() - $createdItems = & $cmd sheet align --created --raw 2>$null - - if ($item -eq "lost") { - $alignOperations = @("confirm") - } elseif ($item -like "lost:*") { - $alignOperations = @("confirm") + $createdItems - } elseif ($item -eq "moved" -or $item -like "moved:*") { - $alignOperations = @("local", "remote", "break") - } elseif ($item -eq "erased" -or $item -like "erased:*") { - $alignOperations = @("confirm") - } else { - $alignOperations = @("local", "remote", "confirm", "break") + $createdItems - } - - return $alignOperations | Where-Object { $_ -like "$wordToComplete*" } - } - } - } - return @() - } - - # Completion for align command - if ($subcmd -eq "align") { - if ($currentIndex -eq 2) { - $alignItems = @("lost", "moved", "erased") - $unsolvedItems = & $cmd sheet align --unsolved --raw 2>$null - $completions = $alignItems + $unsolvedItems - return $completions | Where-Object { $_ -like "$wordToComplete*" } - } elseif ($currentIndex -eq 3) { - $item = $words[2] - $alignOperations = @() - $createdItems = & $cmd sheet align --created --raw 2>$null - - if ($item -eq "lost") { - $alignOperations = @("confirm") - } elseif ($item -like "lost:*") { - $alignOperations = @("confirm") + $createdItems - } elseif ($item -eq "moved" -or $item -like "moved:*") { - $alignOperations = @("local", "remote", "break") - } elseif ($item -eq "erased" -or $item -like "erased:*") { - $alignOperations = @("confirm") - } else { - $alignOperations = @("local", "remote", "confirm", "break") + $createdItems - } - - return $alignOperations | Where-Object { $_ -like "$wordToComplete*" } - } - return @() - } - - # Completion for login command - if ($subcmd -eq "login") { - if ($currentIndex -eq 2) { - $accounts = & $cmd account list --raw 2>$null - return $accounts | Where-Object { $_ -like "$wordToComplete*" } - } elseif ($currentIndex -eq 3) { - $ipHistory = & $cmd _ip_history 2>$null - return $ipHistory | Where-Object { $_ -like "$wordToComplete*" } - } - return @() - } - - # Completion for direct command - if ($subcmd -eq "direct") { - if ($currentIndex -eq 2) { - $ipHistory = & $cmd _ip_history 2>$null - return $ipHistory | Where-Object { $_ -like "$wordToComplete*" } - } - 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 @() - } - - # Completion for share command - if ($subcmd -eq "share") { - if ($currentIndex -eq 2) { - # First parameter: list, see, jv share list --raw results, or files in current directory - $staticOptions = @("list", "see") - $shareList = & $cmd share list --raw 2>$null - $files = Get-ChildItem -Name -File -Path "." 2>$null - $completions = $staticOptions + $shareList + $files - return $completions | Where-Object { $_ -like "$wordToComplete*" } - } elseif ($currentIndex -eq 3) { - # Second parameter: depends on the first parameter - $firstParam = $words[2] - if ($firstParam -eq "list") { - # list -> nothing - return @() - } elseif ($firstParam -eq "see") { - # see -> jv share list --raw results - $shareList = & $cmd share list --raw 2>$null - return $shareList | Where-Object { $_ -like "$wordToComplete*" } - } elseif ($firstParam -like "*@*") { - # Contains "@" (shareid) -> show options - $options = @("--safe", "--overwrite", "--skip", "--reject") - return $options | Where-Object { $_ -like "$wordToComplete*" } - } else { - # Otherwise, assume it's a file -> show jv sheet list --all --raw results - $allSheets = & $cmd sheet list --all --raw 2>$null - return $allSheets | Where-Object { $_ -like "$wordToComplete*" } - } - } - # Third parameter: no completion - return @() - } - - # Aliases completion - switch ($subcmd) { - "as" { - if ($currentIndex -eq 2) { - $accounts = & $cmd account list --raw 2>$null - return $accounts | Where-Object { $_ -like "$wordToComplete*" } - } - } - "use" { - if ($currentIndex -eq 2) { - $sheets = & $cmd sheet list --raw 2>$null - return $sheets | Where-Object { $_ -like "$wordToComplete*" } - } - } - "make" { - if ($currentIndex -eq 2) { - $allSheets = & $cmd sheet list --all --raw 2>$null - return $allSheets | Where-Object { $_ -like "$wordToComplete*" } - } - } - "drop" { - if ($currentIndex -eq 2) { - $sheets = & $cmd sheet list --raw 2>$null - return $sheets | Where-Object { $_ -like "$wordToComplete*" } - } - } - "docs" { - if ($currentIndex -eq 2) { - $docs = & $cmd docs list --raw 2>$null - return $docs | Where-Object { $_ -like "$wordToComplete*" } - } - } - { @("move", "mv", "track", "hold", "throw") -contains $_ } { - # File completion for file operations - return Get-ChildItem -Name -File -Path "." | Where-Object { $_ -like "$wordToComplete*" } - } - } - - return @() -} diff --git a/scripts/deploy/legacy_completions/powershell/completion_jvv.ps1 b/scripts/deploy/legacy_completions/powershell/completion_jvv.ps1 deleted file mode 100644 index fa773c0..0000000 --- a/scripts/deploy/legacy_completions/powershell/completion_jvv.ps1 +++ /dev/null @@ -1,67 +0,0 @@ -# The JustEnoughVCS CommandLine Completion - -Register-ArgumentCompleter -Native -CommandName jvv -ScriptBlock { - param($wordToComplete, $commandAst, $cursorPosition) - - $words = $commandAst.CommandElements | ForEach-Object { $_.ToString() } - $currentIndex = $words.IndexOf($wordToComplete) - if ($currentIndex -lt 0) { $currentIndex = $words.Count } - - $cmd = "jvv" - $subcmd = if ($words.Count -gt 1) { $words[1] } else { $null } - $subsubcmd = if ($words.Count -gt 2) { $words[2] } else { $null } - - # Base commands - $baseCommands = @("create", "init", "here", "member", "service", "listen", "members", "-c", "-i", "-H", "-m", "-l", "-M") - - # Member subcommands - $memberCommands = @("register", "remove", "list", "help", "+", "-", "ls") - - # Service subcommands - $serviceCommands = @("listen", "help") - - # Completion for main command - if ($currentIndex -eq 1) { - return $baseCommands | Where-Object { $_ -like "$wordToComplete*" } - } - - # Completion for member command - if ($subcmd -eq "member" -or $subcmd -eq "-m") { - if ($currentIndex -eq 2) { - return $memberCommands | Where-Object { $_ -like "$wordToComplete*" } - } - - switch ($subsubcmd) { - { @("remove", "-") -contains $_ } { - if ($currentIndex -eq 3) { - $members = & $cmd member list --raw 2>$null - return $members | Where-Object { $_ -like "$wordToComplete*" } - } - } - } - return @() - } - - # Completion for service command - if ($subcmd -eq "service") { - if ($currentIndex -eq 2) { - return $serviceCommands | Where-Object { $_ -like "$wordToComplete*" } - } - return @() - } - - # Aliases completion - switch ($subcmd) { - "-m" { - if ($currentIndex -eq 2) { - return $memberCommands | Where-Object { $_ -like "$wordToComplete*" } - } - } - { @("listen", "-l", "members", "-M") -contains $_ } { - # These commands have no arguments to complete - return @() - } - } - - return @() -} |
