Commit graph

8 commits

Author SHA1 Message Date
95a384bfff lib.App.eloop: Add property
Expose App's __eloop member containing the application's main event
loop to allow outside async event loop trickery.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-20 10:30:25 +01:00
6df4c86fc5 lib.App: Add property cmdline
Add the property App.cmdline, containing the invoking command line as
a string.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-09 20:00:30 +01:00
7fcb031795 jw.pkg.lib.App.__run(): Use return value as exit status
If a Cmd-classes's _run() method returns an integer between 0 and
255, use that as the program's exit status.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-03 11:23:32 +01:00
c8036ad216 jw-pkg.sh: Print help for missing subcommands
Print a help message if no subcommand is specified for one of the
comamnds "distro" and "projects".

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-24 14:52:25 +01:00
7eb15f2477 jw.pkg.lib: Don't log {e}
Don't log an Exception as {e} but as str(e) producing nicer output.
Or as repr(e) if a backtrace is requested, because to people who can
read backtraces, type info might be of interest. Also, remove
pointless time stamps, those belong into the logging framework.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 11:31:13 +01:00
53ba9e6fbe lib.App: Stay functional without autocomplete
If Python's autocomplete is not installed, jw-pkg.py fails to run
commands. Fix that in order stay compatible with minimal excecution
environments.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-02 12:15:41 +01:00
f175f9d5c9 lib.Cmd: Add argument "parent" to __init__()
During __init__(), commands have no idea of their parent. This is not
a problem as of now, but is easy to fix, and it's architecturally
desirable to be prepared just in case, so add the parent argument to
the ctor before more commands are added.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-28 15:24:24 +01:00
0be02c7154 lib.App, .Cmd: Add modules
Add App and Cmd as generic base classes for multi-command
applications. The code is taken from jw-python: The exising
jw.pkg.App is very similar to the more capable jwutils.Cmds class,
so, to avoid code duplication, add it here to allow for jwutils.Cmds
and jw.pkg.App to derive from it at some point in the future.

Both had to be slightly modified to work within jw-pkg's less
equipped context, and will need futher code cleanup.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-26 17:58:23 +01:00