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

When --raw is specified, return full url with the commit in the url #259

Open
AlJohri opened this issue Apr 19, 2017 · 0 comments
Open

When --raw is specified, return full url with the commit in the url #259

AlJohri opened this issue Apr 19, 2017 · 0 comments

Comments

@AlJohri
Copy link

AlJohri commented Apr 19, 2017

I'm trying to push a jupyter notebook to gist and then preview it with rawgit.com.

I have a workaround (below) for the time being but it would be helpful if gist --raw would return the full raw gist url with the commit id in the url.

gist_id=xxx
filename=analysis.html

# upload
gist --private --update "https://gist.github.com/$gist_id" "$filename"

# get commit_id
gist_api_commits_url="https://api.github.com/gists/$gist_id/commits"
gist_commits=$(curl -s $gist_api_commits_url)
commit_id=$(echo "$gist_commits" | jq -r '.[0].version')

# construct raw gist and preview urls
raw_gist_url="https://gist.githubusercontent.com/AlJohri/$gist_id/raw/$commit_id/$filename"
preview_url="https://rawgit.com/AlJohri/$gist_id/raw/$commit_id/$filename"

echo "Raw Gist: $raw_gist_url"
echo "Preview: $preview_url"
open "$preview_url"
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

No branches or pull requests

1 participant