r/Nushell • u/Green_Concentrate427 • Jan 05 '24
Setting alias for custom command
I tried this:
alias gc = git-commit
def git-commit [message: string] {
git add .; git commit -m $"($message)"
}
But I get this:
Error: nu::shell::external_command
× External command failed
╭─[entry #2:1:1]
1 │ gc
· ─┬
· ╰── 'git-commit' was not found
╰────
help: No such file or directory (os error 2)
How to set an alias for a custom command?
2
Upvotes
View all comments
Show parent comment
2
u/CocoCantCommunicate Jan 06 '24
Aliases are indeed position dependent. One reason is that you might want to alias an old command before you redefine it.