Skip to content
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

Make chruby-fish Fish 2.2.0 compatible #26

Merged
merged 2 commits into from
Jan 19, 2016
Merged

Make chruby-fish Fish 2.2.0 compatible #26

merged 2 commits into from
Jan 19, 2016

Conversation

JeanMertz
Copy link
Owner

Removes dependency on string builtin.

closes #25

JeanMertz added a commit that referenced this pull request Jan 19, 2016
Make chruby-fish Fish 2.2.0 compatible
@JeanMertz JeanMertz merged commit 4b73645 into master Jan 19, 2016
@JeanMertz JeanMertz deleted the fish-220 branch January 19, 2016 22:16
@tfausak
Copy link

tfausak commented Jan 19, 2016

👍 Thanks!

set dir (string trim -r -c/ "$dir")
set ruby (string split -m1 -r / $dir | tail -n1)
set dir (echo "$dir" | sed -e 's|/$||')
set ruby (echo "$dir" | awk -F/ '{print $NF}')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeanMertz My only concern with this approach is the availability of sed and awk, as well as differences between distributions (e.g. gawk and mawk). I think cut would be a better solution here, but I cannot 100% guarantee. Thoughts?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge, all (major) distributions of sed and awk support the respective flags used above. Using cut instead of sed would require something like rev | cut -c2- | rev for example, which might perform slower.

Either way, good point, and something to watch out for. If it ever becomes a problem, we can switch this to something else (until Fish 2.3 is released, and we can switch back to using string, that is).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeanMertz Sounds good to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unknown commands with 0.7.1
3 participants