Skip to content

Commit 5d4b66a

Browse files
committed
Filled out more help information. Adding support for -h for help.
1 parent a123ddc commit 5d4b66a

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

quikey/quikey.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@
2121
# Insert your quikey phrase into this file then save and close.
2222
'''
2323

24+
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
25+
2426
def get_database():
2527
appDirs = AppDirectories() # XDG folders
2628
d = Database(appDirs)
2729
return d
2830

29-
@click.group()
31+
@click.group(context_settings=CONTEXT_SETTINGS)
3032
@click.pass_context
3133
def cli(ctx):
34+
"""A keyboard macro tool.
35+
36+
Features, Feedback, and Bugs: https://github.com/bostrt/quikey
37+
"""
3238
ctx.obj = {'database': get_database()}
3339

34-
@cli.command()
40+
@cli.command(help='Add a new phrase')
3541
@click.option('--name' ,'-n', required=True, help='Name of quikey phrase to add.')
3642
@click.option('--tag', '-t', multiple=True, help='Optional tags for the phrase. You can specify this option multiple times.')
3743
@click.option('--phrase', '-p', help='The full phrase to add. If this option is not specified then your default editor ($EDITOR) will be used.')
@@ -58,7 +64,7 @@ def add(ctx,name,phrase,tag):
5864
db.put(name, contents, tag)
5965
click.echo('quikey phrase with key of %s added.' % name)
6066

61-
@cli.command()
67+
@cli.command(help='Edit an existing phrase')
6268
@click.option('--name', '-n', help='Name of quikey phrase to edit.')
6369
@click.pass_context
6470
def edit(ctx,name):
@@ -83,7 +89,7 @@ def edit(ctx,name):
8389
click.echo('quikey phrase with key of %s does not exist.' % name)
8490

8591

86-
@cli.command()
92+
@cli.command(help='Remove a phrase')
8793
@click.option('--name', '-n', help='Name of quikey phrase to remove.')
8894
@click.pass_context
8995
def rm(ctx,name):
@@ -101,7 +107,7 @@ def rm(ctx,name):
101107
else:
102108
click.echo('quikey phrase with key of %s does not exist.' % name)
103109

104-
@cli.command()
110+
@cli.command(help='List all phrases')
105111
@click.option('--show-all', is_flag=True, help='Show the entire quikey phrase instead of a shortened version '
106112
'for long quikey phrases.')
107113
@click.pass_context
@@ -117,7 +123,7 @@ def ls(ctx, show_all):
117123
output = AsciiTable(table)
118124
click.echo(output.table)
119125

120-
@cli.command()
126+
@cli.command(help='Import from AutoKey')
121127
@click.option('--location', '-l', default=BaseDirectory.xdg_config_home+"/autokey/data/", show_default=True, help='Location of top level directory to import from autokey')
122128
@click.pass_context
123129
def keyimport(ctx,location):
@@ -146,11 +152,11 @@ def keyimport(ctx,location):
146152
db.put(key, contents, tags)
147153
click.echo('quikey phrase with key of %s added.' % key)
148154

149-
@cli.command()
155+
@cli.command(help='Display version')
150156
def version():
151157
click.echo("quikey %s" % __version__)
152158

153-
@cli.group()
159+
@cli.group(help='Configure autostart of quikey')
154160
def autostart():
155161
pass
156162

@@ -164,16 +170,16 @@ def disable():
164170
"Disable autostart at login for quikey."
165171
disableAutostart()
166172

167-
@cli.command()
173+
@cli.command(help='Display status of quikey daemon')
168174
@click.pass_context
169175
def status(ctx):
170176
subprocess.run(['quikey-daemon', 'status'])
171177
click.echo("Database location: " + ctx.obj['database'].dbFile)
172178

173-
@cli.command()
179+
@cli.command(help='Start quikey daemon')
174180
def start():
175181
subprocess.run(['quikey-daemon', 'start'])
176182

177-
@cli.command()
183+
@cli.command(help='Stop quikey daemon')
178184
def stop():
179185
subprocess.run(['quikey-daemon', 'stop'])

quikey/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.3-alpha'
1+
__version__ = '0.1.3-alpha2'

0 commit comments

Comments
 (0)