Пример #1
0
def main(args):
    """ Main function """

    try:
        options, arguments = getopt.getopt(args[1:], "g")
    except getopt.error:
        sys.exit(USAGE)
    if len(arguments) != 0:
        sys.exit(USAGE)

    group_level = 0
    for name, _ in options:
        if name == "-g":
            group_level += 1

    tmp_rules, tmp_aliases = {}, {}
    rcfile.read_activity(tmp_rules, tmp_aliases, [])
    rcfile.read_project(tmp_rules, tmp_aliases, [])

    RULES.update(tmp_aliases)
    if group_level > 0:
        RULES.update(tmp_rules)

    data = sys.stdin.read()
    reduce_json(data, group_level)
Пример #2
0
def main(args):
    """ Main function """

    try:
        _, arguments = getopt.getopt(args[1:], "")
    except getopt.error:
        sys.exit(USAGE)
    if len(arguments) != 0:
        sys.exit(USAGE)

    tmp_toplev = []
    rcfile.read_activity({}, {}, tmp_toplev)
    rcfile.read_handle({}, {}, tmp_toplev)
    rcfile.read_project({}, {}, tmp_toplev)
    rcfile.read_tag({}, {}, tmp_toplev)
    TOPLEV.extend(tmp_toplev)

    data = sys.stdin.read()
    validate_json(data)