Skip to content

Instantly share code, notes, and snippets.

@mjyc

mjyc/gise.sh

Last active Apr 4, 2020
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@mjyc 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
You can’t perform that action at this time.