Skip to content

Commit 8304007

Browse files
author
Fa!lko
committed
add option to start term-cheat in filter mode
1 parent 4eb9359 commit 8304007

3 files changed

Lines changed: 27 additions & 5 deletions

File tree

bin/term-cheat-app

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
#!/usr/bin/env python3
2-
2+
import sys
3+
import os, sys
4+
import argparse
35
import termcheat.app
46

5-
termcheat.app.run()
7+
8+
if '__main__' == __name__:
9+
parser = argparse.ArgumentParser(
10+
description='Collect and search terminal commands.',
11+
epilog='Your personal terminal cheat sheet.')
12+
parser.add_argument(
13+
'-f',
14+
'--filter',
15+
action='store_const',
16+
const=True,
17+
help='start in filter mode'
18+
)
19+
20+
try:
21+
options = parser.parse_args()
22+
except:
23+
sys.exit(0)
24+
25+
termcheat.app.run(options.filter)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
setup(name='TermCheat',
7-
version='0.1.8',
7+
version='0.1.11',
88
description='Collect and find termial commands.',
99
author='@select@github.com',
1010
author_email='falko@webpgr.com',

termcheat/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import yaml
1313
from appdirs import AppDirs
1414

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

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

476476

477-
def run():
477+
def run(enable_filter=False):
478478
loop.screen.set_terminal_properties(colors=256)
479+
if enable_filter:
480+
startFilter()
479481
loop.run()
480482

481483

0 commit comments

Comments
 (0)