Skip to content

Commit

Permalink
Add odg list --minus function
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinse committed Nov 9, 2024
1 parent 3dc37b3 commit c99bd10
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/objdictgen/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ def main(debugopts: DebugOpts, args: Sequence[str]|None = None):
subp.add_argument('-i', '--index', action="append", help="Specify parameter index to show")
subp.add_argument('--all', action="store_true",
help="Show all subindexes, including subindex 0")
subp.add_argument('--sort', action="store_true", help="Sort output")
subp.add_argument('--compact', action="store_true", help="Compact listing")
subp.add_argument('--raw', action="store_true", help="Show raw parameter values")
subp.add_argument('--short', action="store_true", help="Do not list sub-index")
subp.add_argument('--unused', action="store_true", help="Include unused profile parameters")
subp.add_argument('--internal', action="store_true", help="Show internal data")
subp.add_argument('--minus', help="Show only parameters that are not in this OD")
subp.add_argument('--no-color', **opt_nocolor) # type: ignore[arg-type]
subp.add_argument('--novalidate', **opt_novalidate) # type: ignore[arg-type]
subp.add_argument('-D', '--debug', **opt_debug) # type: ignore[arg-type]
Expand Down Expand Up @@ -309,6 +309,10 @@ def main(debugopts: DebugOpts, args: Sequence[str]|None = None):
# -- LIST command --
elif opts.command in ("list", "cat"):

minus = None
if opts.minus:
minus = open_od(opts.minus, validate=not opts.novalidate)

for n, name in enumerate(opts.od):

if n > 0:
Expand All @@ -317,7 +321,7 @@ def main(debugopts: DebugOpts, args: Sequence[str]|None = None):
print(Fore.LIGHTBLUE_EX + name + '\n' + "=" * len(name) + Style.RESET_ALL)

od = open_od(name, validate=not opts.novalidate)
for line in format_node(od, name, index=opts.index, opts=opts):
for line in format_node(od, name, index=opts.index, minus=minus, opts=opts):
print(line)


Expand Down

0 comments on commit c99bd10

Please sign in to comment.