An application based on Cmds will now try to read StringTree
formatted config data from a file $HOME/.<name>rc, and make the data
available via the newly added conf_value() method.
Signed-off-by: Jan Lindemann <jan@janware.com>
- Add coding statement
- Import all modules in one line where possible
- Order: __future__, typing, plain imports, from imports,
janware modules
Signed-off-by: Jan Lindemann <jan@janware.com>
Add type annotations as generated by monkeytype and jw-devops/test, plus some
hand editing to satisfy both monkeytype and mypy.
Signed-off-by: Jan Lindemann <jan@janware.com>
jwutils.Cmd.add_subcommands() had two issues. First, it failed for
more than one command, and with that fixed, it only added the first
command of a list of commands passed as an argument. This commit
fixes both issues and leaves some logging and cleanup in place, which
was used during debugging.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add method jwutils.Cmd.add_subcommands(). cmd.add_subcommands(C) will
parse and invoke C as a subcommand of cmd, if C is of type jwutils.cmd.
Signed-off-by: Jan Lindemann <jan@janware.com>
Changes in Python 3 that made the code choke:
o basestring is merged into str
o print() needs parentesis
o Class inheritance syntax changed
o Abstract baseclass (ABCMeta) syntax changed
o map.iteritems() is replaced by map.items()
o Inconsistent use of tabs and spaces are no longer tolerated
Signed-off-by: Jan Lindemann <jan@janware.com>
run_sub_commands() was the only way to access subcommands up to now,
Cmds.run() adds another interface, an object as a place to add
customizations affecting all commands, e.g. global command line
options.
Signed-off-by: Jan Lindemann <jan@janware.com>
More code is removed from the special parser directories and centralized
into grammar.py, Cmd.py, and generate-flex-bison.mk.
Signed-off-by: Jan Lindemann <jan@janware.com>