Skip to content

Commit f1c795e

Browse files
authored
Feature add minus (#58)
* Add odg list --minus function
1 parent 8e06d6c commit f1c795e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/objdictgen/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ def main(debugopts: DebugOpts, args: Sequence[str]|None = None):
174174
subp.add_argument('-i', '--index', action="append", help="Specify parameter index to show")
175175
subp.add_argument('--all', action="store_true",
176176
help="Show all subindexes, including subindex 0")
177-
subp.add_argument('--sort', action="store_true", help="Sort output")
178177
subp.add_argument('--compact', action="store_true", help="Compact listing")
179178
subp.add_argument('--raw', action="store_true", help="Show raw parameter values")
180179
subp.add_argument('--short', action="store_true", help="Do not list sub-index")
181180
subp.add_argument('--unused', action="store_true", help="Include unused profile parameters")
182181
subp.add_argument('--internal', action="store_true", help="Show internal data")
182+
subp.add_argument('--minus', help="Show only parameters that are not in this OD")
183183
subp.add_argument('--no-color', **opt_nocolor) # type: ignore[arg-type]
184184
subp.add_argument('--novalidate', **opt_novalidate) # type: ignore[arg-type]
185185
subp.add_argument('-D', '--debug', **opt_debug) # type: ignore[arg-type]
@@ -309,6 +309,10 @@ def main(debugopts: DebugOpts, args: Sequence[str]|None = None):
309309
# -- LIST command --
310310
elif opts.command in ("list", "cat"):
311311

312+
minus = None
313+
if opts.minus:
314+
minus = open_od(opts.minus, validate=not opts.novalidate)
315+
312316
for n, name in enumerate(opts.od):
313317

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

319323
od = open_od(name, validate=not opts.novalidate)
320-
for line in format_node(od, name, index=opts.index, opts=opts):
324+
for line in format_node(od, name, index=opts.index, minus=minus, opts=opts):
321325
print(line)
322326

323327

0 commit comments

Comments
 (0)