Exemplo n.º 1
0
    if ("COLUMNS" in os.environ): wid = os.environ["COLUMNS"]
    else: wid = 80

    totalRecords = 0
    totalFiles = 0

    if ("COLUMNS" in os.environ):
        wid = int(os.environ["COLUMNS"])
    else:
        lg.vMsg(0, "Can't find environment variable COLUMNS -- export it?")
        wid = 80

    if (len(args.dirs) != 2 or not os.path.isdir(args.dirs[0])
            or not os.path.isdir(args.dirs[1])):
        lg.fatal("Specify exactly 2 directories.")

    rc0 = compareDirs(args.dirs[0], args.dirs[1])

    if (not args.quiet):
        lg.hMsg(0, "Done, rc %d." % (rc0))
        lg.MsgPush()
        lg.vMsg(1, ("Options: b %s, diff %s, i %s, md5 %s,\n" +
                    "           permissions %s, r %s, size %s, time %s.") %
                (args.b, args.diff, args.ignoreCase, args.md5,
                 args.permissions, args.recursive, args.size, args.time))
        lg.vMsg(0, "Dirs: %s\n        %s" % (args.dirs[0], args.dirs[1]))
        lg.pline("Total files from 1:", total1)
        lg.pline("Total files from 2:", total2)
        lg.pline("Missing from 1:", missing1)
        lg.pline("Missing from 2:", missing2)
Exemplo n.º 2
0
    args0 = parser.parse_args()
    lg.setVerbose(args0.verbose)

    if (args0.min>=args0.max or args0.min<0 or args0.max>0x1FFFF):
        lg.fatal("--min and/or --max out of range.")

    # Make sure cells are wide enough for utf display (check dec/hex too?)
    if (args0.utf8 and (
        args0.max >= 0x0000080 and args0.perCell<4 or
        args0.max >= 0x0000800 and args0.perCell<6 or
        args0.max >= 0x0010000 and args0.perCell<8 or
        args0.max >= 0x0200000 and args0.perCell<10 or
        args0.max >= 0x4000000 and args0.perCell<12)):
        lg.error("--perCell width of %d is too narrow for --utf8 of --max %d." %
            (args0.perCell, args0.max))
    return args0

args = processOptions()

if (args.oencoding):
    sys.stdout = codecs.getwriter(args.oencoding)(sys.stdout)

if (args.format == "html"):
    doHTML()
elif (args.format == "text"):
    doText()
else:
    lg.fatal("Unknown --format '%s'." % args.format)
    sys.exit()