Coder Social home page Coder Social logo

ohsevin / gister Goto Github PK

View Code? Open in Web Editor NEW

This project forked from weakish/gister

0.0 0.0 0.0 100 KB

command line tool to sync github gists

Home Page: https://weakish.github.io/gister/

License: Apache License 2.0

Makefile 3.35% Shell 96.65%

gister's Introduction

gister

gister is a command line tool for managing GitHub gists.

Based on gist.rb by @defunkt, this tool helps you to manage a local copy of your gists.

After publishing files to gist.github.com, this tool will:

  • automatically clone the gist repository to local
  • index the content of your gist for code search
  • fetch meta info (e.g. description, url) of the gist from GitHub and add them to gists.list.

You can also use gister to sync your gists (created and starred) between gist.github.com and your machine.

Dependencies

For Linux, BSD, etc, you also need xclip or xsel. For Cygwin, you need putclip/getclip provided by cygutils-extra. (Mas OS X users should be fine with the preinstalled pbcopy/pbpaste.)

Mac OS X users also need GNU versions of sed and date, a.k.a gsed and gdate.

Note: xsel users should use gist.rb v4.1.2+, since there is a bug bitting xsel users in previous versions.

Optional Dependencies

  • csearch

    To search gists on your local machine. If not available, fallbacks to grep.

  • legit

    If available, invokes legit sync to sync gist repository. Legit will stash, fetch, rebase/merge, push, and unstash if necessary.

    The develop branch of legit allows configuration for merge policy:

      * The default smart merge (rebase when suitable)
      * Always merge, never rebase (since [21bb7ed])
      * Always rebase, never merge (since [252b1eb])
      * Fast forward merge only (since [4782928])
    

    If legit is not available, invokes git pull & git push for clean gist repositories, and reports DIRTY $gist_id for dirty gist repositories.

Install

With basher

; basher install weakish/gister

Requires basher version: >=39875bc.

To uninstall:

; basher uninstall weakish/gister

With make

git clone https://github.com/weakish/gister.git
cd gister
make install
  • Edit config.mk if you do not want to install it to /usr/local.
  • Compatible with both GNU and BSD make.

To uninstall:

; cd gister
; make uninstall

Usage

init

For the first time, you need to run gister init to associate your GitHub account and configure the directory to store local copies of your gists.

After that, you may run gister sync to fetch all your gists (created and starred) to local.

Warn: sync can only fetch up to 10 million gists for you. If you have more than 10 million gists, you need to modify the source of gister to lift the limit.

publish

Whenever you want to publish a gist, just use

gister description file.txt ...

This will create the gist with the provided description, clone the gist repo, and put the gistid to clipborad.

Note: you must provide gist description, otherwise gister will fail.

Hint: gister will pass all arguments to gist as gist -c -o -d description ..., so you can use other options that gist understands, e.g. gister description -P will work.

If you've edited your gists at gist.github.com or local machine, without pull/push changesets, you can sync all your gists via gister sync.

If you've deleted your gists at gist.github.com, after gister sync, the directories of deleted gists at your local machine will be marked with a prefix _.

search

Search all of your gists:

gister search regexp

If codesearch is installed, regexp is RE2 (nearly PCRE). Otherwise it is ERE, a.k.a grep -E.

import

Import a gist (available at local) to a git repository, with its full history:

; cd git-repo-root
; gister import gist_id sub_directory_name branch_name

The content of the gist will be imported to sub_directory_name, and the merging message will uses branch_name.

migrate

From version 1.0.0, gister uses a different storage structure. If you have used gister <1.0.0, then you need to run this command to migrate:

gister migrate

Storage

/path/to/your/gists
|-- gists.list  # a list of all your gists (including meta info)
|-- repo # git repositories of your gists
|-- tree # working directory of your gist repositories
    |-- 123456 # an example of gist
    |-- _123567890 # an example of gist which you have deleted on gist.github.com
    |-- ...
`-- .csearchindex # code search index (optional)

Contributing

Send pull requests or issues at:

https://github.com/weakish/gister

gister's People

Contributors

weakish avatar rmax avatar joshbuchea avatar minimaxheadroom avatar fil avatar srijanshetty avatar

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.