Skip to content

Instantly share code, notes, and snippets.

@mjyc
Last active April 4, 2020 20:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjyc/b33ea80309161328716e59f665dc595f to your computer and use it in GitHub Desktop.
Save mjyc/b33ea80309161328716e59f665dc595f to your computer and use it in GitHub Desktop.
Search & edit git-issue in terminal
vim $(grep -lR "$(sk --ansi -i -c 'grep -lER "{}" .issues/issues/ | grep -v tags | grep -v comments | xargs head -q -n 1')" .issues/issues/)
# Support fuzzy matching text in comments and tags (e.g., labels) in addition to titles and descriptions of issues
vim $(grep -lR "$(sk --ansi -i -c 'grep -lER "{}" .issues/issues/ | xargs dirname | awk "{ print \$0 \"/description\" }" | uniq | xargs head -q -n 1')" .issues/issues/)
# Fuzzy text search of issues and display preview on the right panel
sk --ansi -i -c 'grep -lER "{}" .issues/issues/ | xargs dirname | awk "{ print \$0 \"/description\" }" | uniq | xargs head -q -n 1' --preview "grep -lR {} .issues/issues | xargs cat" # improvement ideas - use find to only search "tag"
@mjyc
Copy link
Author

mjyc commented Mar 31, 2020

I've been enjoying @dspinellis's git-issue. The above commands are for searching and editing local issues created or imported via git-issue.

A quick walkthrough of gise.sh:

  1. greps local issues that contains text, which will be placed at "{}" via skim, ignores tag and comment filenames, and returns the title (xargs head ...)
    grep -lER "{}" .issues/issues/ | grep -v tags | grep -v comments | xargs head -q -n 1')"
    
  2. display matching issue titles in real time using skim (i.e., sk)
    sk --ansi -i -c 'grep ... '
    
  3. re-find a desired issue by using the selected issue title (e.g., grep -lR "$(sk --ansi ...)" .issues/issues/) and open it in vim (or your favorite editor)
    vim $(grep -lR "$(sk --ansi ...)" .issues/issues/)
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment