Git Product home page Git Product logo

gifc's Introduction

Gists From Command-line

made-with-python PyPI - Python Version contributions welcome Maintenance License: GPL v3

Welcome to the README of gifc.

ETYMOLOGY

gi-f-c : Gists from command-line

Pronounciation

gifc: jif - sea

ABOUT

This is a nifty little tool written in Python to work with GitHub Gists from command line.

Dependencies

USAGE

  1. Get your token with access to gists from Github.
    • Open the link and click on Generate new token
    • Type your password
    • Type a name for the token. Example: gifc_<your name>
    • Check the box for gists. (You can provide other permissions too)
  2. Add your github user_id and token as environment vaiables to .bashrc. Append the following -

    export GIT_TOKEN="xxxxx"
    export GIT_USER_ID="yyyyy"

  3. To make sure that processes can access the new environment variables, run the following -
    source ~/.bashrc
  4. Clone the repository (currently there is no pip package on PyPI, i intend to add it later)
  5. Extract the contents
  6. From inside the folder do the following based on your preferences -
    • If you want to keep getting the latest updates from GitHub (RECOMMENDED) by pulling them and you want it to reflect in your system as well, then it's best to install it in development mode as -
      pip3 install -e .
    • If you are satisfied with what you have right now, or you are unsure if you like it or you are just curious then install it the usual way -
      pip3 install .
  7. Use it from cli as gifc <options> <flags>. Refer Example usage below.
  8. [ OPTIONAL ] If you want to uninstall then do the following -
    sudo -H pip3 uninstall gifc

MANUAL

gifc -h

Example usage

Get a list of gists

gifc get 5

Create a gist

  • Create interactively from an editor like nano, vim or gedit
    • gifc create create.md -d "How to create a gist from cli" -i nano
  • Directly enter contents from cli
    • gifc create create.md -d "How to create a gist from cli" -m '''If you want to create a gist from an existing file then you do the following- `gifc create create.md -d "How to create a gist from cli" -f file.md`'''
  • Take the contents from a file
    • gifc create create.md -d "How to create a gist from cli" -f file.md

Update a gist

  • Edit all (or some) files iteratively

    • gifc update ffd2f4a482684f56bf33c8726cc6ae63 -i vi
      You can get the gist id from the get method from earlier
  • Change description

    • gifc update ffd2f4a482684f56bf33c8726cc6ae63 -cd "New description"
      You can get the gist id from the get method from earlier
  • Edit contents of a file interactively in an editor like nano, vim or gedit

    • gifc update ffd2f4a482684f56bf33c8726cc6ae63 -f file_to_update.md
  • Do both

    • gifc update ffd2f4a482684f56bf33c8726cc6ae63 -f file_to_update.md -cd "New description"

Delete file(s) from a gist

gifc remove ffd2f4a482684f56bf33c8726cc6ae63 -r file1.md script.py readme.txt
You can get the gist id from the get method from earlier

Delete the whole gist

gifc delete ffd2f4a482684f56bf33c8726cc6ae63
You can get the gist id from the get method from earlier

COPYRIGHT and LICENSE

All the source files are licensed under GNU GLPv3 license. Refer LICENSE.md for more details.

Gifc is a tool written in Python to work with GitHub Gists from command line.
Copyright (C) 2018  Shantam Raj
This code is licensed under GNU GPLv3 license. See LICENSE.md for details

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.