Permalink
Browse files

Add 'description' command.

  • Loading branch information...
karanparikh committed Feb 25, 2015
1 parent e3f91da commit 40821c5aa03be68908471c74f0217b46424cfcfc
Showing with 72 additions and 27 deletions.
  1. +20 −10 README.rst
  2. +10 −1 bin/gist
  3. +25 −0 gist/gist.py
  4. +2 −2 share/gist-fzf.bash
  5. +2 −2 share/gist-fzsl.bash
  6. +2 −2 share/gist.bash
  7. +11 −10 share/gist.fish
View
@@ -90,16 +90,17 @@ command line. There are several commands available:
::
gist create - creates a new gist
gist edit - edit the files in your gist
gist list - prints a list of your gists
gist clone - clones a gist
gist delete - deletes a gist from github
gist files - prints a list of the files in a gist
gist archive - downloads a gist and creates a tarball
gist content - prints the content of the gist to stdout
gist info - prints detailed information about a gist
gist version - prints the current version
gist create - creates a new gist
gist edit - edit the files in your gist
gist description - updates the description of your gist
gist list - prints a list of your gists
gist clone - clones a gist
gist delete - deletes a gist from github
gist files - prints a list of the files in a gist
gist archive - downloads a gist and creates a tarball
gist content - prints the content of the gist to stdout
gist info - prints detailed information about a gist
gist version - prints the current version
**gist create**
@@ -146,6 +147,15 @@ by the EDITOR environment variable) to edit the files in the gist. When the
editor is exited the user is prompted to commit the changes, which are then
pushed back to the remote.
**gist description**
You can update the description of your gist with the 'description' command.
You need to supply the gist ID and the new description. For example -
::
$ gist description e1f5e95a1705cbfde144 "This is a new description"
**gist list**
View
@@ -6,6 +6,7 @@ Name:
Usage:
gist list
gist edit <id>
gist description <id> <desc>
gist info <id>
gist fork <id>
gist files <id>
@@ -47,6 +48,9 @@ Commands:
fork
Creates a fork of the specified gist.
description
Updates the description of a gist.
list
Returns a list of your gists. The gists are returned as,
@@ -268,9 +272,14 @@ def main(argv=sys.argv[1:]):
return
if args['edit']:
info = gapi.edit(args['<id>'])
gapi.edit(args['<id>'])
return
if args['description']:
gist_id = args['<id>']
description = args['<desc>']
gapi.description(gist_id, description)
if args['fork']:
info = gapi.fork(args['<id>'])
return
View
@@ -66,6 +66,16 @@ def post(cls, func):
"""
return cls(func, method='POST')
@classmethod
def patch(cls, func):
"""Create an authenticate object with a PATCH method
Arguments:
func: a function to decorate
"""
return cls(func, method='PATCH')
@classmethod
def delete(cls, func):
"""Create an authenticate object with a DELETE method
@@ -306,6 +316,21 @@ def fork(self, request, id):
"""
return self.send(request, '{}/forks'.format(id))
@authenticate.patch
def description(self, request, id, description):
"""Updates the description of a gist
Arguments:
request: an initial request object
id: the id of the gist we want to edit the description for
description: the new description
"""
request.data = json.dumps({
"description": description
})
return self.send(request, id).json()['html_url']
def clone(self, id, name=None):
"""Clone a gist
View
@@ -9,7 +9,7 @@ __gist() {
COMPREPLY=()
case ${cmd} in
edit|archive|files|content|clone|info)
edit|description|archive|files|content|clone|info)
if (( ${COMP_CWORD} == 2 )); then
tput smcup
COMPREPLY=( $( gist list | fzf | cut -d" " -f1 ) )
@@ -24,7 +24,7 @@ __gist() {
create|list|fork)
;;
*)
COMPREPLY=( $(compgen -W "edit delete create fork archive files content clone list info" -- $curr) )
COMPREPLY=( $(compgen -W "edit description delete create fork archive files content clone list info" -- $curr) )
;;
esac
View
@@ -9,7 +9,7 @@ __gist() {
COMPREPLY=()
case ${cmd} in
edit|archive|files|content|clone|info)
edit|description|archive|files|content|clone|info)
if (( ${COMP_CWORD} == 2 )); then
tput smcup
COMPREPLY=( $( gist list | fzsl | cut -d" " -f1 ) )
@@ -24,7 +24,7 @@ __gist() {
create|list|fork)
;;
*)
COMPREPLY=( $(compgen -W "edit delete create fork archive files content clone list info" -- $curr) )
COMPREPLY=( $(compgen -W "edit description delete create fork archive files content clone list info" -- $curr) )
;;
esac
View
@@ -7,7 +7,7 @@ __gist() {
COMPREPLY=()
case ${cmd} in
edit|delete|archive|files|content|clone|list|info|fork)
edit|description|delete|archive|files|content|clone|list|info|fork)
;;
create)
if (( ${COMP_CWORD} >= 2 )); then
@@ -16,7 +16,7 @@ __gist() {
fi
;;
*)
COMPREPLY=( $(compgen -W "edit delete create fork archive files content clone list info" -- $curr) )
COMPREPLY=( $(compgen -W "edit description delete create fork archive files content clone list info" -- $curr) )
;;
esac
View
@@ -1,10 +1,11 @@
complete -c gist -f -a "create" -d "Creates a new gist"
complete -c gist -f -a "edit" -d "Edit the files in your gist"
complete -c gist -f -a "list" -d "Prints a list of your gists"
complete -c gist -f -a "clone" -d "Clones a gist"
complete -c gist -f -a "delete" -d "Deletes a gist from GitHub"
complete -c gist -f -a "files" -d "Prints a list of the files in a gist"
complete -c gist -f -a "archive" -d "Downloads a gist and creates a tarball"
complete -c gist -f -a "content" -d "Prints the content of the gist to stdout"
complete -c gist -f -a "info" -d "Prints detailed information about a gist"
complete -c gist -f -a "version" -d "Prints the current version"
complete -c gist -f -a "create" -d "Creates a new gist"
complete -c gist -f -a "edit" -d "Edit the files in your gist"
complete -c gist -f -a "list" -d "Prints a list of your gists"
complete -c gist -f -a "clone" -d "Clones a gist"
complete -c gist -f -a "delete" -d "Deletes a gist from GitHub"
complete -c gist -f -a "files" -d "Prints a list of the files in a gist"
complete -c gist -f -a "archive" -d "Downloads a gist and creates a tarball"
complete -c gist -f -a "content" -d "Prints the content of the gist to stdout"
complete -c gist -f -a "info" -d "Prints detailed information about a gist"
complete -c gist -f -a "version" -d "Prints the current version"
complete -c gist -f -a "description" -d "Updates the description of a gist."

0 comments on commit 40821c5

Please sign in to comment.