-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/add-interactive-stack-trace' int…
…o add-interactive-stack-trace
- Loading branch information
Showing
18 changed files
with
435 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
3.4.3 | ||
3.5.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
_pros_completion() { | ||
local IFS=$'\n' | ||
local response | ||
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _PROS_COMPLETE=bash_complete $1) | ||
for completion in $response; do | ||
IFS=',' read type value <<<"$completion" | ||
if [[ $type == 'dir' ]]; then | ||
COMPREPLY=() | ||
compopt -o dirnames | ||
elif [[ $type == 'file' ]]; then | ||
COMPREPLY=() | ||
compopt -o default | ||
elif [[ $type == 'plain' ]]; then | ||
COMPREPLY+=($value) | ||
fi | ||
done | ||
return 0 | ||
} | ||
_pros_completion_setup() { | ||
if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then | ||
complete -o nosort -F _pros_completion pros | ||
else | ||
complete -F _pros_completion pros | ||
fi | ||
} | ||
_pros_completion_setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Modified from https://github.com/StephLin/click-pwsh/blob/main/click_pwsh/shell_completion.py#L11 | ||
Register-ArgumentCompleter -Native -CommandName pros -ScriptBlock { | ||
param($wordToComplete, $commandAst, $cursorPosition) | ||
$env:COMP_WORDS = $commandAst | ||
$env:COMP_WORDS = $env:COMP_WORDS.replace('\\', '/') | ||
$incompleteCommand = $commandAst.ToString() | ||
$myCursorPosition = $cursorPosition | ||
if ($myCursorPosition -gt $incompleteCommand.Length) { | ||
$myCursorPosition = $incompleteCommand.Length | ||
} | ||
$env:COMP_CWORD = @($incompleteCommand.substring(0, $myCursorPosition).Split(" ") | Where-Object { $_ -ne "" }).Length | ||
if ( $wordToComplete.Length -gt 0) { $env:COMP_CWORD -= 1 } | ||
$env:_PROS_COMPLETE = "powershell_complete" | ||
pros | ForEach-Object { | ||
$type, $value, $help = $_.Split(",", 3) | ||
if ( ($type -eq "plain") -and ![string]::IsNullOrEmpty($value) ) { | ||
[System.Management.Automation.CompletionResult]::new($value, $value, "ParameterValue", $value) | ||
} | ||
elseif ( ($type -eq "file") -or ($type -eq "dir") ) { | ||
if ([string]::IsNullOrEmpty($wordToComplete)) { | ||
$dir = "./" | ||
} | ||
else { | ||
$dir = $wordToComplete.replace('\\', '/') | ||
} | ||
if ( (Test-Path -Path $dir) -and ((Get-Item $dir) -is [System.IO.DirectoryInfo]) ) { | ||
[System.Management.Automation.CompletionResult]::new($dir, $dir, "ParameterValue", $dir) | ||
} | ||
Get-ChildItem -Path $dir | Resolve-Path -Relative | ForEach-Object { | ||
$path = $_.ToString().replace('\\', '/').replace('Microsoft.PowerShell.Core/FileSystem::', '') | ||
$isDir = $false | ||
if ((Get-Item $path) -is [System.IO.DirectoryInfo]) { | ||
$path = $path + "/" | ||
$isDir = $true | ||
} | ||
if ( ($type -eq "file") -or ( ($type -eq "dir") -and $isDir ) ) { | ||
[System.Management.Automation.CompletionResult]::new($path, $path, "ParameterValue", $path) | ||
} | ||
} | ||
} | ||
} | ||
$env:COMP_WORDS = $null | Out-Null | ||
$env:COMP_CWORD = $null | Out-Null | ||
$env:_PROS_COMPLETE = $null | Out-Null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
_pros_completion() { | ||
local -a completions | ||
local -a completions_with_descriptions | ||
local -a response | ||
(( ! $+commands[pros] )) && return 1 | ||
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _PROS_COMPLETE=zsh_complete pros)}") | ||
for type key descr in ${response}; do | ||
if [[ "$type" == "plain" ]]; then | ||
if [[ "$descr" == "_" ]]; then | ||
completions+=("$key") | ||
else | ||
completions_with_descriptions+=("$key":"$descr") | ||
fi | ||
elif [[ "$type" == "dir" ]]; then | ||
_path_files -/ | ||
elif [[ "$type" == "file" ]]; then | ||
_path_files -f | ||
fi | ||
done | ||
if [ -n "$completions_with_descriptions" ]; then | ||
_describe -V unsorted completions_with_descriptions -U | ||
fi | ||
if [ -n "$completions" ]; then | ||
compadd -U -V unsorted -a completions | ||
fi | ||
} | ||
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then | ||
_pros_completion "$@" | ||
else | ||
compdef _pros_completion pros | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function _pros_completion; | ||
set -l response (env _PROS_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) pros); | ||
for completion in $response; | ||
set -l metadata (string split "," $completion); | ||
if test $metadata[1] = "dir"; | ||
__fish_complete_directories $metadata[2]; | ||
else if test $metadata[1] = "file"; | ||
__fish_complete_path $metadata[2]; | ||
else if test $metadata[1] = "plain"; | ||
echo $metadata[2]; | ||
end; | ||
end; | ||
end; | ||
complete --no-files --command pros --arguments "(_pros_completion)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.