How to use the gita.utils.write_to_groups_file function in gita

To help you get started, we’ve selected a few gita examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nosarthur / gita / gita / __main__.py View on Github external
def f_group(args: argparse.Namespace):
    groups = utils.get_groups()
    if args.to_group:
        gname = input('group name? ')
        if gname in groups:
            gname_repos = set(groups[gname])
            gname_repos.update(args.to_group)
            groups[gname] = sorted(gname_repos)
            utils.write_to_groups_file(groups, 'w')
        else:
            utils.write_to_groups_file({gname: sorted(args.to_group)}, 'a+')
    else:
        for group, repos in groups.items():
            print(f"{group}: {', '.join(repos)}")
github nosarthur / gita / gita / __main__.py View on Github external
def f_ungroup(args: argparse.Namespace):
    groups = utils.get_groups()
    to_ungroup = set(args.to_ungroup)
    to_del = []
    for name, repos in groups.items():
        remaining = set(repos) - to_ungroup
        if remaining:
            groups[name] = list(sorted(remaining))
        else:
            to_del.append(name)
    for name in to_del:
        del groups[name]
    utils.write_to_groups_file(groups, 'w')
github nosarthur / gita / gita / __main__.py View on Github external
def f_group(args: argparse.Namespace):
    groups = utils.get_groups()
    if args.to_group:
        gname = input('group name? ')
        if gname in groups:
            gname_repos = set(groups[gname])
            gname_repos.update(args.to_group)
            groups[gname] = sorted(gname_repos)
            utils.write_to_groups_file(groups, 'w')
        else:
            utils.write_to_groups_file({gname: sorted(args.to_group)}, 'a+')
    else:
        for group, repos in groups.items():
            print(f"{group}: {', '.join(repos)}")