-
Notifications
You must be signed in to change notification settings - Fork 143
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
replace jq with cut #50
Conversation
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.
TIL about cut
fuelup-init.sh
Outdated
@@ -25,8 +24,7 @@ main() { | |||
mkdir -p "$FUELUP_DIR/bin" | |||
|
|||
local _fuelup_version | |||
_fuelup_version="$(curl -s https://api.github.com/repos/FuelLabs/fuelup/releases/latest | jq -r ".tag_name")" | |||
_fuelup_version="$(echo "${_fuelup_version}" | cut -c 2-)" | |||
_fuelup_version="$(curl -s https://api.github.com/repos/FuelLabs/fuelup/releases/latest | grep -r "tag_name" | cut -d "\"" -f4 | cut -c 2-)" |
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.
_fuelup_version="$(curl -s https://api.github.com/repos/FuelLabs/fuelup/releases/latest | grep -r "tag_name" | cut -d "\"" -f4 | cut -c 2-)" | |
_fuelup_version="$(curl -s https://api.github.com/repos/FuelLabs/fuelup/releases/latest | grep "tag_name" | cut -d "\"" -f4 | cut -c 2-)" |
Just tested this locally, but had to remove the recursive flag to get this to work. Otherwise looks good!
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.
Can you file an issue to temporary-workaround replacing jq
, and close that instead? We should keep the non-brittle solution as an open issue.
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.
utACK
Closes #52
We use a combination of
grep
andcut
instead ofjq
."tag_name": "v0.1.2"
The above is the output of the grep, then:
cut -d "\"" -f4 | cut -c 2-
this splits the above string with the
"
delimiter, getting thev0.1.2
portion and cutting off thev
This may not also be the ideal way, but it's one solution as well, unless the solution described in the issue is preferred.