Package: gists.cli.py3
Table of Contentsgenerated withDocTocGists.cliOverviewFor the Casual UserInstallationAuthenticationUsageFor The Advanced UserTipsUsageFor the DeveloperInstallationNon-Mac/OS X System TestingIn DevelopmentIssues and RoadmapTroubleshootingCreditsGists.cliAn easy to use CLI to manageyourGitHub Gists. Create, edit, append, view, search and backup your Gists.Github -https://github.com/khilnani/gists.cliPython Package -https://pypi.python.org/pypi/gists.cliOverviewI'm a Developer who uses VI and the like. iPad and iPhone apps are great, but when I really need a Gist i'm at the command line.The primary goal is to create something designed specifically to capture quick notes/links while requiring minimum typing.
In addition to conventional view, download, edit and delete support, the application attempts to consider a variety scenarios -Append - Ability to append text to a Gist instead of having to download, edit and update.iOS support -Pythonistais pretty damn cool. UsePypi.pyorPipistaVGA terminals - Using a mouse to copy/paste Gists IDs is great, but when a mouse is not handy index number can be used instead of a Gist IDs.Usegists .1orgists :1orgists %1to view the first Gist. Easier but less explicit thangists 233HSHS2233Executing without download - You can pipe the output from the application to an interpreter as appropriate. eg.gists 1111 | shEach command/action has aliases/formats to suit your preferences.Usegists --helporgists -hif you prefer standard CLI optiions, or justgists helporgists hif you want to type lessFor the Casual UserExtensioninstall with githubpip installgit+https://github.com/jiahut/gists.clipip install --upgradehttps://github.com/jiahut/gists.cli/tarball/mastersupport open gist at browserrun gists open .1add the-as the prefixrun gists -o -1InstallationMac OS X / Linuxsudo easy_install gists.cliUsing PIPInstall Python Setup ToolsCentOSRunyum install python-setuptoolsManual InstallRuncurl -v https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo pythonor, follow instructions at [https://pypi.python.org/pypi/setuptools#installation-instructions]Install the Python package manager PIP (http://www.pip-installer.org/)Runsudo easy_install pipOnce PIP is installed,Runsudo pip install gists.cliRunsudo pip install gists.cli --upgradeif upgrading.Check the installed version by runningpip show gists.cliAuthenticationTwo factor authentication (SMS and Application) supported as of 0.350By default the application will attempt to use Basic Auth to authenticate i.e. will prompt for username/password each time it is run.If the file~/.git-credentialsis available, it will use the first OAuth token entry.If the file~/.gistswith a Github OAuth token is found, it will be given preference over the above two mechanisms.Rungists token|--token|t|-tto avoid the username/password prompt and to use an OAuth Token other than~/.git-credentials. Saves to~/.gists.UsageAll the commands below are interactive and will prompt for user input (eg. public/private, descriptions) and confirmations (eg. directory creation).Each Action/Command has multiple alias e.g. Create can be invoked not only bygists new|create, but alsogists c|n|new|create|--new|--create|-n|-cRungists help|--help|-h|hfor more info.List all your GistsgistsView a Gistgists ID- View all files within a Gist with ID on the console.ID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NDownload a Gistgists ID PATH- Download Gist files with ID to PATH. Will prompt for confirmation.ID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NCreate a GistWe'll prompt for stuff like Gist type (public/private), Description and Gist Content as needed.gists neworgists create.gists FILE- Create a Gist using the contents of FILEgists "Content"- Create a Gist using the string "Content"To avoid the Public/private Gist type prompt -Bool should betruefor Public,falsefor Privategists Bool FILEgists Bool "Content"Append to a GistIf Description or Content is '?', that field will be skipped.eg.gists 223322 ? "New link to cool site"will append a new line but will not update the Descriptioneg.gists 223322 "Updated Description ?will only update the DescriptionID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NNOTE - If a Gist contains more than one file, each file will have a new line appended with the content sent.gists ID Description FILEgists ID Description "Content"Delete to a Gistgists delete ID- Will prompt for confirmation.For The Advanced UserTipsEach Action/Command has multiple alias e.g. Create can be invoked not only bygists new|create, but alsogists c|n|new|create|--new|--create|-n|-cRungists help|--help|-h|hfor more infoID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NAdddebug|--debugto the end of any execution to view low level details. eg.gists debug.NOTE - This will reveal your OAuth ID but not your Basic Auth password.Addsupress|silent|--supress|--silientat the end of any execution to supress any prompts of confirmations if you like to live dangerously.eg.gists -n FILE --supress --debug.UsageIn addition to the usage examples above, you can also gain additional flexibility by specifying command line options (eg. -g, --get)All the commands below are interactive and will prompt for user input.List all your Gistsgists list|--list|-l|lView a Gistgists view|--view|v|-v ID- View all files within a Gist with ID on the console.gists view|--view|v|-v ID FILE- View a specific file (FILE) in a Gist on the console. The matching is case-insensitive.ID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NDownload a Gistgists get|--get|g|-g ID PATH- Download Gist files with ID to PATH. Will prompt for confirmation.gists get|--get|g|-g ID FILE PATH- Download a specific file (FILE) in a Gist to PATH. The matching is case-insensitive.ID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NSetup OAuth tokengists token|t|--token|-t- Setup to use OAuth Token other than~/.git-credentials. Saves to~/.gists.Create a GistFILE - is a file path, relative or absolute.Bool - True for Public, False for Private. Supports True, False, 1, 0, Yes, No, y, n. Case-insensitiveDescription and Content - Text content within quotesWithout specifying a command (eg. create, new), the application will trying to figure it out. However, this supports fewer combinations of arguments.gists FILEgists "Content"gists Bool FILEgists Bool "Content"gists "Description" FILEgists "Description" "Content"gists Bool "Description" FILEgists Bool "Description" "Content"If you like to type, or be specific you can also use the command line option. You will be prompted for stuff like Gist type, Description and Gist Content etc as needed.OPTION=new|--new|n|-n|create|--create|c|-cgists OPTIONgists OPTION FILEgists OPTION "Content"gists OPTION Bool FILEgists OPTION Bool "Content"gists OPTION "Description" FILEgists OPTION "Description" "Content"gists OPTION Bool "Description" FILEgists OPTION Bool "Description" "Content"Append to a GistIf Description or Content is '?', that field will be skipped.eg.gists 223322 ? "New link to cool site"will append a new line but will not update the Descriptioneg.gists 223322 "Updated Description ?will only update the DescriptionID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NWithout specifiying a specific action, the following will result in an Append.NOTE - If a Gist contains more than one file, each file will have a new line appended with the content sent.gists ID Description FILEgists ID Description "Content"For more control/specificityOPTION=append|--append|a|-agists OPTION ID Filegists OPTION ID Contentgists OPTION ID Description Filegists OPTION ID Description ContentUpdateIf Description or Content is '?', that field will be skipped.eg.gists 223322 ? "New link to cool site"will append a new line but will not update the Descriptioneg.gists 223322 "Updated Description ?will only update the DescriptionID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NNOTE - A file in a Gist will be updated only if the file name sent is an exact match. If not file name match is found, a new file is added to the Gist.OPTION=update|--update|u|-ugists OPTION ID Filegists OPTION ID Contentgists OPTION ID Description Filegists OPTION ID Description ContentDeletegists delete|del|d|--delete|--del|-d ID- Delete a Gist. Will prompt for confirmation.ID can be a Gist ID or Index ID (of the Gist in the List view) Index must be in the format'#N',%N,.Nor:NIn DevelopmentExport/Backupgists backup|b|--backup|-b [DIR]- Backup all Gists in the user's account.Searchgists search|query|q|--search|--query|-q QUERY- Search Gists.Miscgists stars|--stars- List starred GistsFor the DeveloperInstallationIf you would like to contribute changes to the code baseGet the codeFork andgit clonethe fork, or ...git clone https://github.com/khilnani/gists.cli.git, or ...Download the latest Tag Archive fromhttps://github.com/khilnani/gists.cliDownloading the Archive is not recommended, since it won't be easy to merge code back.Install dependencies by running./dependencies.sh.This installs PIP (if not already installed) and then installs the dependencies.Run the installer as below. If you get any error run withsudo ..../install.pywith no arguments will install to/usr/local/bin../install.py INSTALL_PATHwill install to a specific directory.Non-Mac/OS X System TestingI usehttp://VagrantUp.com,http://ansibleworks.comandhttp://www.virtualBox.orgto test on CentOS and Ubuntu.PrerequisitesVagrantInstall Vagrant -http://vagrantup.com/downloadsAnsibleInstall Ansible on Mac OS X or CentOS/RHEL -https://github.com/khilnani/devops/tree/master/ansibleVirtual BoxInstall VirtualBox -https://www.virtualbox.org/wiki/Downloadsto download/installRunRunvagrant upto install both CentOS6.5 and Ubuntu, orvagrant up centosorvagrant up ubuntu- start the VMsIf my Boxes are not already installed, they will be downloaded and installedRunvagrant ssh centosorvagrant ssh ubuntu- to ssh overOnce you SSH over, the current directory is available at/git_dataon the VMDebugChange directory to./_vagrantRun./debug.ssh up centosor./debug.ssh up ubuntu- This runs Vagrant with Debug Level INFOIssues and RoadmapTake a look athttps://github.com/khilnani/gists.cli/issuesto view Issues and Milestones.TroubleshootingIf you get the errorWheel installs require setuptools >= 0.8 for dist-info supportorImportError: No module named pkg_resources, please ensure you have upgraded setup tools. See the 'Install Python Setup Tools/Manual Install' section above to upgrade setup tools.This dependency was introduced in Pypi 1.5 and will be removed in Pypi 1.5.1 [http://pip.readthedocs.org/en/1.5.X/news.html#].If you get the errorAttributeError: VerifiedHTTPSConnection instance has no attribute '_tunnel_host, this is likely due to you running Python 2.6.2 or earlier.Runningsudo pip install requests==1.2.3resolves the issue. The requests 2.0 library uses urllib3 that uses some capabilities only available in Python 2.6.3CreditsAuthor - Nik Khilnani -http://khilnani.orgFeedback and Spellcheck - Alexander -https://github.com/alexander-bzzStack Overflow -http://stackoverflow.com/questions/tagged/pythonPythonista Forums -https://omz-forums.appspot.com/pythonista/post/4691117899513856