copia-cli alias set¶
copia-cli alias set <alias> <expansion> [flags]
Define a word that will expand to a full copia-cli command when invoked.
The expansion may specify additional arguments and flags. If the expansion includes positional placeholders such as "$1", extra arguments that follow the alias are inserted appropriately. Otherwise, extra arguments are appended to the expanded command. An argument fills a placeholder as one word and is never split again.
Use "-" as the expansion argument to read the expansion string from standard input.
If the expansion starts with "!" or if "--shell" was given, the expansion is a shell expression evaluated through the "sh" interpreter; extra arguments are passed to it as "$1", "$2" and so on. This allows compounding commands with "|" to pipe output to other commands.
An alias may not have the name of a copia-cli command, and the expansion of an alias that is no shell expression must start with a copia-cli command. Aliases are saved under "aliases" in the config file.
Quotes must always be used when defining a command as in the examples.
Options¶
--clobber- Overwrite existing aliases of the same name
-s,--shell- Declare an alias to be passed through a shell interpreter
Options inherited from parent commands¶
--host <string>- Target Copia host
-R,--repo <string>- Select repository (owner/repo)
--token <string>- Authentication token
Examples¶
$ copia-cli alias set il 'issue list -L 1'
$ copia-cli il
#=> copia-cli issue list -L 1
$ copia-cli alias set co 'pr checkout'
$ copia-cli co 23
#=> copia-cli pr checkout 23
$ copia-cli alias set bugs 'issue list --label $1'
$ copia-cli bugs urgent
#=> copia-cli issue list --label urgent
$ copia-cli alias set --shell igrep \
'copia-cli issue list --label "$1" | grep "$2"'
$ copia-cli igrep epic foo
#=> copia-cli issue list --label epic | grep foo