mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 01:17:45 +00:00
4c34ba9959
Don't wrap fish_indent at all if the version in $PATH matches $FISH_VERSION. When we do wrap it, resolve the path once, and use that via alias machinery instead of doing an eval each time. In both cases, `type fish_indent` can tell us what it's actually going to do now. clarity aside, it's faster if we only eval the one time. eval is not only evil, but slow. > for h in $history[1..100]; echo $h | fish_indent --no-indent; end before: CMD_DURATION = 1005 if fish_indent is kosher in PATH: 549 if not, using alias: 687
7 lines
423 B
Fish
7 lines
423 B
Fish
# check if command fish_indent works and is the same version that
|
|
# came with this fish. This will happen one time.
|
|
command -s fish_indent > /dev/null
|
|
and command fish_indent --version 2>&1 | string match -rq $FISH_VERSION
|
|
# if alias doesn't define the function here, this is an autoloaded "nothing".
|
|
# the command (if there is one) will be used by default.
|
|
or alias fish_indent=(string escape $__fish_bin_dir/fish_indent)
|