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

replace jq with cut #50

Merged
merged 5 commits into from
May 30, 2022
Merged

replace jq with cut #50

merged 5 commits into from
May 30, 2022

Conversation

eightfilms
Copy link
Contributor

@eightfilms eightfilms commented May 30, 2022

Closes #52

We use a combination of grep and cut instead of jq.

"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 the v0.1.2 portion and cutting off the v

This may not also be the ideal way, but it's one solution as well, unless the solution described in the issue is preferred.

@eightfilms eightfilms self-assigned this May 30, 2022
Copy link
Contributor

@mitchmindtree mitchmindtree left a 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-)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_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!

Copy link
Contributor

@adlerjohn adlerjohn left a 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.

Copy link
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

utACK

@eightfilms eightfilms merged commit 52264a0 into master May 30, 2022
@eightfilms eightfilms deleted the binggh/replace-jq-with-cut branch May 30, 2022 23:55
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.

Replace jq with cut as an intermediate solution to remove dependence on jq
3 participants