Skip to content

Commit

Permalink
Use cut instead of grep for rustc version (spaceship-prompt#520)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Snuggle authored and salmanulfarzy committed Oct 4, 2018
1 parent a5d5d31 commit 1895517
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sections/rust.zsh
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ spaceship_rust() {

spaceship::exists rustc || return

local rust_version=$(rustc --version | grep --color=never -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]')
local rust_version=$(rustc --version | cut -d' ' -f2)

spaceship::section \
"$SPACESHIP_RUST_COLOR" \

0 comments on commit 1895517

Please sign in to comment.