CLI interface for managing GitHub gists
Two ways of installation:
- Download the source code, extract it, and execute
python setup.py install
pip install gists
First time you run 'gists', execute the command
$ gists authorize -u your_github_user -s your_github_password
And the file ~/.gistsrc (which stores the 'gists' configuration) will be written with your GitHub api authentication token.
Anytime you can revoke your authentication token in your applications page on GitHub.
Gists uses the file '~/.gistsrc' to obtain your GitHub authentication token. First thing you need to do is set up your credentials to perform actions that needs authentication. Method is just:
$ gists authorize -u your_github_user -s your_github_password
You can perform this actions many times you wish to override the values.
If you don't want to authorize the app, you can always use the -u and -s parameters to provide the credentials in each command.
Return a list of gists. Basic usage is:
$ gists list
This will return a list of Gists from field user from [credentials] section in your (~/.gistsrc) file.
- -u (--user) specifies from whom user you want to retrieve his/her gists.
- -p (--private) retrieves the private gists from the user besides the public ones. (Needs authentication)
Shows the detail of a Gist. There are two modes here: without the -f argument, that will show the Gist metadata (url, description, name of the files...) and with the -f argument, that shows the content of one of the files of the Gist. Identifier of the Gist, (obtained via gists list
) is mandatory as first argument.
Example without -f argument:
$ gists show e110cc498a31dc442fc3
Example with -f argument:
$ gists show e110cc498a31dc442fc3 -f examplegist.txt
Download a file from a Gist using the 'get' action. While in the 'show' action the parameter -f is optional depending on the kind of data you want to show, here is mandatory. So, a basic usage is:
$ gists get e110cc498a31dc442fc3 -f examplegist.txt
The name of the target file in your OS will be the same of the argument provided by -f. There is no way to change this.
- -o (--output_dir) destination directory where you want to save the gist
Creates a Gist. Needs a file to be uploaded. So, authentication and -f arguments are required. Basic usage is:
$ gists create -f examplegist.txt
The name of the file in the OS will be the same of the name of the file in the Gist. No way to change this.
- -p (--private) whenever you want the Gist to be private.
- -d (--description) Set the description of the Gist.
- -i (--input_dir) Specify the input directory where the file is.
Update an existent Gist. Several examples:
To modify the description, use the -d (--description) argument:
$ gists update e110cc498a31dc442fc3 -d "New gist description"
Modify the contents of a File that already exists in the Gist:
$ gists update e110cc498a31dc442fc3 -f examplegist.txt
Modify a Gist adding a new file, using the -n (--new) argument:
$ gists update e110cc498a31dc442fc3 -f new_file_to_gist.py -n
Modify a Gist removing one of its files, using the -r (--remove) argument:
$ gists update e110cc498a31dc442fc3 -f no_longer_needed_file.py -r
- -i (--input_dir) Specify the input directory where the file is.