MCPcopy
hub / github.com/apenwarr/redo / main

Function main

redo/cmd_whichdo.py:7–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6
7def main():
8 if len(sys.argv[1:]) != 1:
9 sys.stderr.write('%s: exactly one argument expected.\n' % sys.argv[0])
10 sys.exit(1)
11
12 env.init_no_state()
13 logs.setup(
14 tty=sys.stderr, parent_logs=env.v.LOG,
15 pretty=env.v.PRETTY, color=env.v.COLOR)
16
17 want = sys.argv[1]
18 if not want:
19 err('cannot build the empty target ("").\n')
20 sys.exit(204)
21
22 abswant = os.path.abspath(want)
23 pdf = paths.possible_do_files(abswant)
24 for dodir, dofile, basedir, basename, ext in pdf:
25 dopath = os.path.join('/', dodir, dofile)
26 relpath = os.path.relpath(dopath, '.')
27 exists = os.path.exists(dopath)
28 assert '\n' not in relpath
29 print relpath
30 if exists:
31 sys.exit(0)
32 sys.exit(1) # no appropriate dofile found
33
34
35if __name__ == '__main__':

Callers 1

cmd_whichdo.pyFile · 0.70

Calls 2

errFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected