Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature add minus #58

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading