Commit graph

13 commits

Author SHA1 Message Date
4b8d67b8ee Cmd.add_subcommand(): Add support for passing cmd argument as string
Signed-off-by: Jan Lindemann <jan@janware.com>
2024-12-03 13:34:25 +01:00
77d43aebad Add type annotations from monkeytype + jw-devops/test
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>
2020-04-10 17:55:36 +02:00
952bf4a4e1 Fix Python errors reported by mypy
This commit fixes Python errors and warnings reported by static type checking
with mypy.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-10 14:17:15 +02:00
33d3b7a7b3 jwutils.Cmds: Cmd.add_subcommands() fails for multiple commands
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>
2020-04-07 09:23:13 +02:00
c5b964a5bb jwutils.Cmd: Add method add_subcommands()
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>
2020-04-04 16:32:39 +02:00
a85f0929c6 Consistently replace def run() by async def run()
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-12-20 08:41:58 +01:00
6dd594d47b Fix multiple Python 3 compatibility issues
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>
2019-03-10 16:38:59 +01:00
fd125f07fe Add class Cmds
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>
2018-12-11 14:10:01 +01:00
2b23026bfa Add HDRDIR_SCOPE_SUFFIX to ytools include files
Change ytools header location from #include <header.h> to
#include <ytools/header.h>.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-12-18 19:32:49 +01:00
6297f10f55 grammar.py et al: Centralize more code
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>
2017-10-29 18:25:55 +01:00
4e3a6630da log.py: Add set_flags()
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-10-25 10:06:29 +02:00
51bbed559d Cmd.py: Fix log inclusion
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-10-16 12:23:24 +02:00
22cabb4eac Add Cmd.py
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-10-14 17:25:24 +02:00