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>
jwutils.log.set_flags() and .set_level() is not set until after all
commands are loaded. This can make debugging complicated. OTOH,
command-line parsing is also not done until all commands are loaded,
because they define the command line options. This commit adds some
poor man's command line parsing for fetching --log-level and
--log-flags only, and applying them before the commands are all
loaded.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add support for adding children of type StringTree. If a StringTree
argument is passed to .add(), this should do the right thing. It
makes use of the newly added .__add_children() method and involves
quite a bit of hairy case distinctions.
Signed-off-by: Jan Lindemann <jan@janware.com>
parse() and read() up to present automatically set the root content
of a StringTree object to "root". This can now be optionally defined
by the "root_content" keyword argument.
Signed-off-by: Jan Lindemann <jan@janware.com>
- Add functions: append_to_prefix(),
remove_from_prefix() set_filename_length()
- Make slog_m() log one list item per line
- Add console_color_chars(prio)
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit makee Cmds run all sub-commands in an asyncio event loop.
The event loop is currently passed to the commands, which seems
unnecessary and looks like it's using a feature which is bound to be
deprecated in the future.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add leading underscore to variables that should not be visible
outside of log.py. Also do some indentation beautification.
Signed-off-by: Jan Lindemann <jan@janware.com>
object_builtin_name() is meant to derive an object name from its
class name. Doesn't work well, but adding the code nonetheless for
improving it later.
Signed-off-by: Jan Lindemann <jan@janware.com>
PROJECTS_DIR is a final version of where the projects to be compiled against
are. DEV_PROJECTS_DIR is merely a candidate, used in proj.mk, currently only
there.
Signed-off-by: Jan Lindemann <jan@janware.com>
Make the MODDIR definition in proj.mk depend on the environment:
- Change "=" assignment to "?="
- Prepend $(BUILD_TOOLS_PREFIX) to /opt/jw-build
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit flips some more switches from Python 2 to Python 3 in makefiles and
Python code. Build runs through, but it's still likely to break things.
Signed-off-by: Jan Lindemann <jan@janware.com>