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

Let's use cut instead of grep! #520

Merged
merged 1 commit into from
Oct 4, 2018
Merged

Let's use cut instead of grep! #520

merged 1 commit into from
Oct 4, 2018

Conversation

Snuggle
Copy link
Contributor

@Snuggle Snuggle commented Oct 4, 2018

Description

This is a small change that is being upstreamed from the "spacefish" fork of spaceship-prompt. While porting this prompt section to be fish-shell compatible, we found a more elegant solution for returning the rust version number.

The main advantage with using cut, over using grep is increased compatibility with other coreutils while being much more concise. This has been tested using GNU, BSD, Ripgrep, Busybox and Toybox coreutils — the latter three would have failed otherwise, due to a grep flag incompatibility.

This change increases compatibility and cleans up a line of code.

Screenshot(s)

image

This is a small change that is being upstreamed from the
"spacefish" fork of spaceship-prompt. While porting this
prompt section to be fish-shell compatible, we found a
more elegant solution for getting the rust version.

Co-authored-by: Matan Kushner <hello@matchai.me>
Copy link
Member

@salmanulfarzy salmanulfarzy left a comment

Choose a reason for hiding this comment

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

Thank you @Snuggle 👍

@salmanulfarzy salmanulfarzy added the improvement A PR that make small changes for improving UX, performance, readability, etc label Oct 4, 2018
@salmanulfarzy salmanulfarzy merged commit 1895517 into spaceship-prompt:master Oct 4, 2018
@salmanulfarzy
Copy link
Member

salmanulfarzy commented Oct 4, 2018

This displays the toolchain with version information, If on channels other than stable.

rust version toolchain

@Snuggle Snuggle deleted the rust-is-rusty branch October 4, 2018 09:23
@denysdovhan
Copy link
Member

@Snuggle nice job with Spacefish! Feel free to add a link in our readme to this awesome fork!

@Snuggle
Copy link
Contributor Author

Snuggle commented Oct 5, 2018

@salmanulfarzy That's a really good point! I've added an extra configuration option to enable showing that branch suffix in #521. (Since this pull request has already been merged/branch deleted.)

It will default to the shortened version number, without a suffix, to follow CONTRIBUTING.md's "decluttering" guideline. ✨

~ ~ ~

@denysdovhan Hey, thanks! I'll leave that to @matchai to add, since they're amazing at making things look beautiful and I feel like they'd like the honor of adding their project themselves!

This is by far my favourite prompt and it's amazing to see such an awesomely made fork, and be able to collaborate to it. It's been a really nice first-project to start learning how to contribute on GitHub, especially because of the incredibly in-depth feedback I've recieved from @matchai. 😊

dedene pushed a commit to zenjoy/spaceship-prompt that referenced this pull request Feb 24, 2019
The main advantage with using cut, over using grep is increased compatibility with other coreutils while being much more concise. This has been tested using GNU, BSD, Ripgrep, Busybox and Toybox coreutils — the latter three would have failed otherwise, due to a grep flag incompatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A PR that make small changes for improving UX, performance, readability, etc
Development

Successfully merging this pull request may close these issues.

None yet

3 participants