Skip to content

Commit

Permalink
gctcli: bump urfave cli depends version (thrasher-corp#698)
Browse files Browse the repository at this point in the history
* gctcli: bump version

* gctcli: flag alias done differenttttttttttttt

* gctcli: add autocomplete scripts to folder within gctcli cmd folder structure
  • Loading branch information
shazbert authored Jun 24, 2021
1 parent d978b3b commit 79a47cf
Show file tree
Hide file tree
Showing 11 changed files with 428 additions and 368 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#! /bin/bash

# bash programmable completion for gctcli
# copy to /etc/bash_completion.d/gctcli and source it or restart your shell
# For info on implementation for current shell session or persistence:
# https://github.com/urfave/cli/blob/master/docs/v2/manual.md#enabling

: ${PROG:=$(basename ${BASH_SOURCE})}

Expand Down
13 changes: 13 additions & 0 deletions cmd/gctcli/autocomplete/gctcli.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# PowerShell programmable completion for gctcli
# For info on implementation for current shell session or persistence:
# https://github.com/urfave/cli/blob/master/docs/v2/manual.md#powershell-support

$fn = $($MyInvocation.MyCommand.Name)
$name = $fn -replace "(.*)\.ps1$", '$1'
Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
$other = "$wordToComplete --generate-bash-completion"
Invoke-Expression $other | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
27 changes: 27 additions & 0 deletions cmd/gctcli/autocomplete/zsh_autocomplete
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#compdef $PROG

# zsh programmable completion for gctcli
# For info on implementation for current shell session or persistence:
# https://github.com/urfave/cli/blob/master/docs/v2/manual.md#zsh-support

_gctcli() {

local -a opts
local cur
cur=${words[-1]}
if [[ "$cur" == "-"* ]]; then
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
else
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
fi

if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi

return
}

compdef _gctcli $PROG
Loading

0 comments on commit 79a47cf

Please sign in to comment.