diff --git a/bin/term-cheat-app b/bin/term-cheat-app index b792b30..ba8a7d6 100755 --- a/bin/term-cheat-app +++ b/bin/term-cheat-app @@ -1,5 +1,25 @@ #!/usr/bin/env python3 - +import sys +import os, sys +import argparse import termcheat.app -termcheat.app.run() \ No newline at end of file + +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) diff --git a/setup.py b/setup.py index f095dc5..9ba5ee4 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup(name='TermCheat', - version='0.1.8', + version='0.1.11', description='Collect and find termial commands.', author='@select@github.com', author_email='falko@webpgr.com', diff --git a/termcheat/app.py b/termcheat/app.py index f7ae59b..5573d2e 100644 --- a/termcheat/app.py +++ b/termcheat/app.py @@ -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') @@ -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()