Skip to main content

Alias

Specify the same alias cross shell.

Syntaxโ€‹

alias:
- name: a
value: aliae
- name: hello-world
value: echo "hello world"
type: function
- name: sync
value: "!git fetch origin; git rebase origin/HEAD"
type: git
- name: pyfmt
value: "import sys; print(' '.join(sys.argv[1:]))"
type: python
- name: plfmt
value: "print join(' ', @ARGV)"
type: perl

Aliasโ€‹

NameTypeDescription
namestringthe alias name
valuestringthe command(s) you want to execute, supports templating
typestring
  • command: a regular alias, value is a one-liner (default)
  • function: a code block to be placed inside a function
  • git: a git alias definition
  • python: runs value as inline Python source with python from PATH
  • perl: runs value as inline Perl source with perl from PATH
ifstringgolang template conditional statement, see if

python and perl alias types are not available in tcsh.

Shell specific configurationโ€‹

NameTypeDescription
descriptionstringspecifies a description of the alias
forcebooleanuse the force parameter to change or delete an alias that has the Option parameter set to ReadOnly. The Force parameter cannot change or delete an alias with the option parameter set to Constant
optionstringsee the PowerShell documentation
scopestringsee the PowerShell documentation

Expected output by shell and alias typeโ€‹

The examples below use:

alias:
- name: foo
value: bar
type: command
- name: fn
value: bar
type: function
- name: pyfoo
value: print(123)
type: python
- name: plfoo
value: print qq(123)
type: perl
- name: h
value: log --oneline --graph --decorate --all
type: git

git aliases are written with git config --global, not as shell alias syntax. Most shells emit:

git config --global alias.h 'log --oneline --graph --decorate --all'

Nushell uses a raw string variant:

git config --global alias.h r#'log --oneline --graph --decorate --all'#
alias foo="bar"
fn() {
bar
}
pyfoo() {
python -c "print(123)" "$@"
}
plfoo() {
perl -e "print qq(123)" "$@"
}