mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
enable make style-all
doing fish scripts
I had disabled having `make style-all` restyling fish scripts because a majority of them did not conform to the style enforced by `fish_indent`. I recently restyled most of the fish scripts with the exception of the completion scripts. So this re-enables restyling all scripts with the exception of completion scripts.
This commit is contained in:
parent
9443a415bf
commit
42eaacd3a1
3 changed files with 145 additions and 141 deletions
|
@ -30,12 +30,10 @@ if test $all = yes
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
set c_files src/*.h src/*.cpp
|
set c_files src/*.h src/*.cpp
|
||||||
# For now we don't restyle all the fish scripts. That's because `fish_indent` still has some
|
# For now we don't restyle all fish scripts other than completion scripts. That's because people
|
||||||
# problems with its output that require manual intervention. Not to mention that very few of the
|
# really like to vertically align the elements of the `complete` command and fish_indent
|
||||||
# fish scripts even conform to `fish_indent` output at this time. When `fish_indent` output is
|
# currently does not honor that whitespace.
|
||||||
# deemed acceptable as a default and all the fish scripts have been restyled this comment should
|
set f_files (printf '%s\n' share/***.fish | grep -v /completions/)
|
||||||
# be removed and the following statement uncommented.
|
|
||||||
# set f_files share/***.fish
|
|
||||||
else
|
else
|
||||||
# We haven't been asked to reformat all the source. If there are uncommitted changes reformat
|
# We haven't been asked to reformat all the source. If there are uncommitted changes reformat
|
||||||
# those using `git clang-format`. Else reformat the files in the most recent commit.
|
# those using `git clang-format`. Else reformat the files in the most recent commit.
|
||||||
|
|
|
@ -46,7 +46,8 @@ if status --is-interactive
|
||||||
or test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit # slang expects this
|
or test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit # slang expects this
|
||||||
end
|
end
|
||||||
# Only set it if it isn't to allow override by setting to 0
|
# Only set it if it isn't to allow override by setting to 0
|
||||||
set -q fish_term24bit; or set -g fish_term24bit 1
|
set -q fish_term24bit
|
||||||
|
or set -g fish_term24bit 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -134,8 +135,11 @@ function __fish_load_path_helper_paths
|
||||||
end
|
end
|
||||||
set __fish_tmp_path $__fish_tmp_path[-1..1]
|
set __fish_tmp_path $__fish_tmp_path[-1..1]
|
||||||
end
|
end
|
||||||
test -r /etc/paths ; and __fish_load_path_helper_paths < /etc/paths
|
test -r /etc/paths
|
||||||
for pathfile in /etc/paths.d/* ; __fish_load_path_helper_paths < $pathfile ; end
|
and __fish_load_path_helper_paths </etc/paths
|
||||||
|
for pathfile in /etc/paths.d/*
|
||||||
|
__fish_load_path_helper_paths <$pathfile
|
||||||
|
end
|
||||||
set -xg PATH $__fish_tmp_path
|
set -xg PATH $__fish_tmp_path
|
||||||
set -e __fish_tmp_path
|
set -e __fish_tmp_path
|
||||||
functions -e __fish_load_path_helper_paths
|
functions -e __fish_load_path_helper_paths
|
||||||
|
@ -205,11 +209,13 @@ __fish_set_locale
|
||||||
set -l sourcelist
|
set -l sourcelist
|
||||||
for file in $configdir/fish/conf.d/*.fish $__fish_sysconfdir/conf.d/*.fish $__extra_confdir/*.fish
|
for file in $configdir/fish/conf.d/*.fish $__fish_sysconfdir/conf.d/*.fish $__extra_confdir/*.fish
|
||||||
set -l basename (string replace -r '^.*/' '' -- $file)
|
set -l basename (string replace -r '^.*/' '' -- $file)
|
||||||
contains -- $basename $sourcelist; and continue
|
contains -- $basename $sourcelist
|
||||||
|
and continue
|
||||||
set sourcelist $sourcelist $basename
|
set sourcelist $sourcelist $basename
|
||||||
# Also skip non-files or unreadable files
|
# Also skip non-files or unreadable files
|
||||||
# This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd)
|
# This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd)
|
||||||
[ -f $file -a -r $file ]; and source $file
|
[ -f $file -a -r $file ]
|
||||||
|
and source $file
|
||||||
end
|
end
|
||||||
|
|
||||||
# Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax
|
# Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax
|
||||||
|
|
|
@ -11,16 +11,16 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
|
||||||
else if test -r /etc/hosts
|
else if test -r /etc/hosts
|
||||||
# Ignore commented lines and functionally empty lines. Strip comments.
|
# Ignore commented lines and functionally empty lines. Strip comments.
|
||||||
string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' </etc/hosts | string replace -ra '#.*$' '' | string replace -r '[0-9.]*\s*' '' | string trim | string replace -ra '\s+' '\n'
|
string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' </etc/hosts | string replace -ra '#.*$' '' | string replace -r '[0-9.]*\s*' '' | string trim | string replace -ra '\s+' '\n'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print nfs servers from /etc/fstab
|
# Print nfs servers from /etc/fstab
|
||||||
if test -r /etc/fstab
|
if test -r /etc/fstab
|
||||||
string match -r '^\s*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3]:|^[a-zA-Z\.]*:' </etc/fstab | string replace -r ':.*' ''
|
string match -r '^\s*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3]:|^[a-zA-Z\.]*:' </etc/fstab | string replace -r ':.*' ''
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check hosts known to ssh
|
# Check hosts known to ssh
|
||||||
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/known_hosts{,2} # Yes, seriously - the default specifies both with and without "2"
|
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/known_hosts{,2} # Yes, seriously - the default specifies both with and without "2"
|
||||||
for file in /etc/ssh/ssh_config ~/.ssh/config
|
for file in /etc/ssh/ssh_config ~/.ssh/config
|
||||||
if test -r $file
|
if test -r $file
|
||||||
# Print hosts from system wide ssh configuration file
|
# Print hosts from system wide ssh configuration file
|
||||||
# Note the non-capturing group to avoid printing "name"
|
# Note the non-capturing group to avoid printing "name"
|
||||||
|
@ -28,11 +28,11 @@ for file in /etc/ssh/ssh_config ~/.ssh/config
|
||||||
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
|
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
|
||||||
| string replace -ri '.*KnownHostsFile\s*' '')
|
| string replace -ri '.*KnownHostsFile\s*' '')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for file in $known_hosts
|
for file in $known_hosts
|
||||||
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
|
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
|
||||||
test -r $file
|
test -r $file
|
||||||
and string replace -ra '(\S+) .*' '$1' <$file | string match -r '^[^#|[=]+$' | string split ","
|
and string replace -ra '(\S+) .*' '$1' <$file | string match -r '^[^#|[=]+$' | string split ","
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue