Last active
November 1, 2018 17:15
-
-
Save kennethgillen/cfe6850fa557230b7394036b86cc077c to your computer and use it in GitHub Desktop.
# A simple shim using WRK to make fast Trello searching work from the UI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# A simple shim using WRK to make fast Trello searching work from the CLI. | |
import subprocess | |
import sys | |
import re | |
import argparse | |
debug= False | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-b", "--board", help="The code of the board you wish to search, eg `sa`.") | |
parser.add_argument("-m", "--modified", help="Cards modified, in trello parlance 'edited', in the past {MODIFIED} days.") | |
parser.add_argument("-o", "--open", help="search for open cards only", | |
action="store_true") | |
parser.add_argument("-y", "--year", help="Searches for cards opened in the past 365 days.", | |
action="store_true") | |
parser.add_argument("search_terms", help="Terms to search for", nargs='*') | |
args = parser.parse_args() | |
search_command = "wrk search" | |
if args.board == "sa": | |
if debug: | |
print "Searching board: " + args.board | |
search_command= search_command + " board:Sysadmin" | |
if args.modified is not None: | |
if debug: | |
print "searching for cards modified 'edited' in the past " + args.modified + " days." | |
search_command= search_command + " edited:" + args.modified | |
if args.open: | |
if debug: | |
print "searching for open cards only" | |
search_command= search_command + " is:open" | |
if args.year: | |
if debug: | |
print "searching for -365 days" | |
search_command= search_command + " created:365" | |
# Convert the list to a string with spaces | |
search_terms= " ".join(args.search_terms) | |
search_command= search_command + " " + search_terms | |
process = subprocess.Popen(search_command.split()) | |
output, error = process.communicate() | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment