alias: fix indentation

Fixes #11602
This commit is contained in:
Johannes Altmanninger
2025-06-23 13:51:55 +02:00
parent ebec8c15ab
commit 096f225579
2 changed files with 9 additions and 10 deletions

View File

@@ -10,7 +10,6 @@ function alias --description 'Creates a function wrapping a command'
set -l name
set -l body
set -l prefix
if not set -q argv[1]
# Print the known aliases.
@@ -51,9 +50,9 @@ function alias --description 'Creates a function wrapping a command'
# $body starts with the same command as $name.
if test $first_word = $name
if contains $name (builtin --names)
set prefix builtin
set body "builtin $body"
else
set prefix command
set body "command $body"
end
end
set -l cmd_string (string escape -- "alias $argv")
@@ -67,8 +66,8 @@ function alias --description 'Creates a function wrapping a command'
set wraps --wraps (string escape -- $body)
end
echo "function $name $wraps --description $cmd_string; $prefix $body \$argv
end" | source # The function definition in split in two lines to ensure that a '#' can be put in the body.
# The function definition in split in two lines to ensure that a '#' can be put in the body.
echo "function $name $wraps --description $cmd_string"\n"$body \$argv"\n"end" | source
if set -q _flag_save
funcsave $name
end