MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / main

Function main

tools/python-3.11.9-amd64/Tools/scripts/ndiff.py:84–114  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

82# return false iff a problem
83
84def main(args):
85 import getopt
86 try:
87 opts, args = getopt.getopt(args, "qr:")
88 except getopt.error as detail:
89 return fail(str(detail))
90 noisy = 1
91 qseen = rseen = 0
92 for opt, val in opts:
93 if opt == "-q":
94 qseen = 1
95 noisy = 0
96 elif opt == "-r":
97 rseen = 1
98 whichfile = val
99 if qseen and rseen:
100 return fail("can't specify both -q and -r")
101 if rseen:
102 if args:
103 return fail("no args allowed with -r option")
104 if whichfile in ("1", "2"):
105 restore(whichfile)
106 return 1
107 return fail("-r value must be 1 or 2")
108 if len(args) != 2:
109 return fail("need 2 filename args")
110 f1name, f2name = args
111 if noisy:
112 print('-:', f1name)
113 print('+:', f2name)
114 return fcompare(f1name, f2name)
115
116# read ndiff output from stdin, and print file1 (which=='1') or
117# file2 (which=='2') to stdout

Callers 1

ndiff.pyFile · 0.70

Calls 6

failFunction · 0.85
strFunction · 0.85
fcompareFunction · 0.85
restoreFunction · 0.70
printFunction · 0.50
getoptMethod · 0.45

Tested by

no test coverage detected