Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Fingercomp

Gist uploader and downloader

Recommended Posts

This program can download gists, upload files to gist and do some more things.

It uses JSON library, which will be downloaded automatically if it is missing.

 

Usage:

 

For example, you need to upload some junk.

To do this, you need to specify -p flag. --P=s flag makes your gist to be a secret one (it will not show up in lists). Use --desc="description" to provide a description for a gist. Then you should specify each file you want to upload as argument. (/path/to/the/file/on/computer.lua=fileOnGistWith.ext). The command will look like this:

gist -p --P=s --desc="Hello, world!" /examples/hello.c=helloworld.c /examples/hello.lua=helloworld.lua

You will get a long URL to the created gist, like this one: https://gist.github.com/anonymous/a2b3c5d7e9f1a3b5c7d9e

That's why there's a -s option. If you specify it when uploading, you'll get a short URL.

 

Let's assume you want to download this gist.

If you type the following command:

gist a2b3c5d7e9f1a3b5c7d9e

the contents of the gist will be printed on the screen. But what if there are multiple files? Then you'll get an error with a list of files. So I need to choose one and specify it with the --f option: --f=helloworld.c.

If this program was unable to save contents to a file, I think, it would be useless. So if you need to save gist to the file /tmp/helloworld.c, you should place it after the gist ID.

gist --f=helloworld.c a2b3c5d7e9f1a3b5c7d9e /tmp/helloworld.c

If the output file existed, you had to specify -r flag.

Instead of gist ID you can use Git.io URL.

 

There's some other options left.

  • -s. Shorten a specified URL via Git.io.
  • -R. Show a raw file contents URL.
  • -q. Quiet mode: do not show regular info.
  • -Q. Superquiet mode: do not show errors.
  • -l. List files in a gist.
  • -i. Show info about file.
  • -G. Show info about gist.

If you won't specify any arguments, the help will be displayed.

 

Download:

wget https://raw.githubusercontent.com/OpenPrograms/Fingercomp-Programs/master/gist/gist.lua gist.lua
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.