correct docs

This commit is contained in:
vilmibm 2020-07-14 19:42:05 -05:00
parent 4bd0435c38
commit a9d93f8c57

View file

@ -41,10 +41,13 @@ var aliasSetCmd = &cobra.Command{
that follow the invocation of an alias will be inserted appropriately.
If '--shell' is specified, the alias will be run through a shell interpreter (sh or pwsh). This allows you
to compose commands with "|" or redirect output. Note that extra arguments following the alias
to compose commands with "|" or redirect with ">". Note that extra arguments following the alias
will not be automatically passed to the expanded expression. To have a shell alias receive
arguments, you must explicitly accept them using "$1", "$2", etc or "$@" to accept all of them.
Platform note: on Windows, shell aliases are executed via "sh" as installed by Git For Windows. If
you have installed git on Windows in some other way, shell aliases may not work for you.
Quotes must always be used when defining a command as in the examples.`),
Example: heredoc.Doc(`
$ gh alias set pv 'pr view'
@ -57,15 +60,9 @@ var aliasSetCmd = &cobra.Command{
$ gh epicsBy vilmibm
#=> gh issue list --author="vilmibm" --label="epic"
# On macOS and Linux:
$ gh alias set --shell igrep 'gh issue list --label="$1" | grep $2'
$ gh igrep epic foo
#=> gh issue list --label="epic" | grep "foo"
# On Windows (Powershell):
$ gh alias set --shell igrep 'gh issue list --label=$args[0] | Select-String -Pattern $args[1]
$ gh igrep epic foo
#=> gh issue list --label=epic | Select-String -Pattern foo`),
#=> gh issue list --label="epic" | grep "foo"`),
Args: cobra.ExactArgs(2),
RunE: aliasSet,
}