Make command names easier to type
This commit is contained in:
parent
0501b62c8b
commit
5ed084147d
|
@ -12,7 +12,7 @@ def repl(args):
|
||||||
"""Runs a REPL with the given lexicon"""
|
"""Runs a REPL with the given lexicon"""
|
||||||
# Get all the cli commands' descriptions and add help and exit.
|
# Get all the cli commands' descriptions and add help and exit.
|
||||||
commands = {
|
commands = {
|
||||||
name[8:]: func.__doc__ for name, func in vars(cli).items()
|
name[8:].replace("_", "-"): func.__doc__ for name, func in vars(cli).items()
|
||||||
if name.startswith("command_")}
|
if name.startswith("command_")}
|
||||||
commands['help'] = "Print this message"
|
commands['help'] = "Print this message"
|
||||||
commands['exit'] = "Exit"
|
commands['exit'] = "Exit"
|
||||||
|
@ -106,7 +106,7 @@ def get_parser(valid_commands):
|
||||||
def main(argv):
|
def main(argv):
|
||||||
# Enumerate valid commands from the CLI module.
|
# Enumerate valid commands from the CLI module.
|
||||||
commands = {
|
commands = {
|
||||||
name[8:] : func
|
name[8:].replace("_", "-") : func
|
||||||
for name, func in vars(cli).items()
|
for name, func in vars(cli).items()
|
||||||
if name.startswith("command_")}
|
if name.startswith("command_")}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue