-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix!: align Fish entrypoint behaviour with other shells #1524
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ insert_final_newline = true | |
|
||
[*.py] | ||
indent_size = 4 | ||
|
||
[*.fish] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
if not set -q ASDF_DIR | ||
set -x ASDF_DIR (dirname (status -f)) | ||
if test -z $ASDF_DIR | ||
set ASDF_DIR (realpath (dirname (status filename))) | ||
end | ||
set --export ASDF_DIR $ASDF_DIR | ||
|
||
# Add asdf to PATH | ||
# fish_add_path was added in fish 3.2, so we need a fallback for older version | ||
if type -q fish_add_path | ||
if test -n "$ASDF_DATA_DIR" | ||
fish_add_path --global --move "$ASDF_DATA_DIR/shims" "$ASDF_DIR/bin" | ||
else | ||
fish_add_path --global --move "$HOME/.asdf/shims" "$ASDF_DIR/bin" | ||
end | ||
set -l _asdf_bin "$ASDF_DIR/bin" | ||
if test -z $ASDF_DATA_DIR | ||
set _asdf_shims "$HOME/.asdf/shims" | ||
else | ||
set -l asdf_user_shims ( | ||
if test -n "$ASDF_DATA_DIR" | ||
printf "%s\n" "$ASDF_DATA_DIR/shims" | ||
else | ||
printf "%s\n" "$HOME/.asdf/shims" | ||
end | ||
) | ||
|
||
set -l asdf_bin_dirs $ASDF_DIR/bin $asdf_user_shims | ||
set _asdf_shims "$ASDF_DATA_DIR/shims" | ||
end | ||
|
||
for x in $asdf_bin_dirs | ||
if test -d $x | ||
for i in (seq 1 (count $PATH)) | ||
if test $PATH[$i] = $x | ||
set -e PATH[$i] | ||
break | ||
end | ||
end | ||
end | ||
set PATH $x $PATH | ||
end | ||
# Do not use fish_add_path (added in Fish 3.2) because it | ||
# potentially changes the order of items in fish_user_paths | ||
if not contains $_asdf_bin $fish_user_paths | ||
set --global --prepend fish_user_paths $_asdf_bin | ||
end | ||
if not contains $_asdf_shims $fish_user_paths | ||
set --global --prepend fish_user_paths $_asdf_shims | ||
end | ||
set --erase _asdf_bin _asdf_shims | ||
|
||
# Load the asdf wrapper function | ||
. $ASDF_DIR/lib/asdf.fish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
|
||
# Add function wrapper so we can export variables | ||
# The asdf function is a wrapper so we can export variables | ||
function asdf | ||
set command $argv[1] | ||
set -e argv[1] | ||
|
||
switch "$command" | ||
case "shell" | ||
# source commands that need to export variables | ||
case shell | ||
# Source commands that need to export variables. | ||
command asdf export-shell-version fish $argv | source # asdf_allow: source | ||
case '*' | ||
# forward other commands to asdf script | ||
# Forward other commands to asdf script. | ||
command asdf "$command" $argv | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is run locally, it would be ideal to check Fish is available or error with a warning to the user that it is required.
Even more ideal would be to get
fish_indent
as a standalone CLI tool and manage it with our.tool-versions
file so people get the same experience as withshellcheck
andshfmt
in this repo.A separate Issue tracking this would suffice I would say.