Skip to content

Commit

Permalink
add option to start term-cheat in filter mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Fa!lko committed Feb 11, 2019
1 parent 4eb9359 commit 8304007
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
24 changes: 22 additions & 2 deletions bin/term-cheat-app
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
#!/usr/bin/env python3

import sys
import os, sys
import argparse
import termcheat.app

termcheat.app.run()

if '__main__' == __name__:
parser = argparse.ArgumentParser(
description='Collect and search terminal commands.',
epilog='Your personal terminal cheat sheet.')
parser.add_argument(
'-f',
'--filter',
action='store_const',
const=True,
help='start in filter mode'
)

try:
options = parser.parse_args()
except:
sys.exit(0)

termcheat.app.run(options.filter)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


setup(name='TermCheat',
version='0.1.8',
version='0.1.11',
description='Collect and find termial commands.',
author='@[email protected]',
author_email='[email protected]',
Expand Down
6 changes: 4 additions & 2 deletions termcheat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import yaml
from appdirs import AppDirs


a = 'hello'
dirs = AppDirs("term-cheat", "Select")
commands_file_path = path.join(dirs.user_data_dir, 'commands.yaml')

Expand Down Expand Up @@ -474,8 +474,10 @@ def seperator(): return ('pack', urwid.Text([('seperator', u'\uE0B1'), ' ']))
loop = urwid.MainLoop(ui_body, palette, screen, unhandled_input=unhandledInput, pop_ups=True)


def run():
def run(enable_filter=False):
loop.screen.set_terminal_properties(colors=256)
if enable_filter:
startFilter()
loop.run()


Expand Down

0 comments on commit 8304007

Please sign in to comment.