def setup():
    g['currentPage'] = None
    g['livePage'] = LivePage()
    g['notePage'] = note_page.NotePage()
    g['drumPage'] = drum_page.DrumPage()
    g['faderPage'] = fader_page.FaderPage()
    g['programmerPage'] = ProgrammerPage()
    ui.setup(modeChangeHandler=ModeChangeHandler(), midiHandler=MidiHandler())
Exemple #2
0
def test_color_never(smart_tty):
    ui.setup(color="never")
    ui.info(ui.red, "this is red", fileobj=smart_tty)
    assert RED not in smart_tty.getvalue()
Exemple #3
0
def test_color_always(dumb_tty):
    ui.setup(color="always")
    ui.info(ui.red, "this is red", fileobj=dumb_tty)
    assert RED in dumb_tty.getvalue()
Exemple #4
0
def test_quiet(message_recorder):
    ui.setup(quiet=True)
    ui.info("info")
    ui.error("error")
    assert message_recorder.find("error")
    assert not message_recorder.find("info")
Exemple #5
0
    parser.add_argument(
        "-bc",
        "--breachcomp",
        dest="bc_path",
        help=
        "Path to the breachcompilation Torrent. https://ghostbin.com/paste/2cbdn"
    )

    parser.add_argument("-v",
                        "--verbose",
                        dest="verbosity",
                        help="Show debug information",
                        action="store_true",
                        default=False)
    parser.add_argument("-l",
                        "--local",
                        dest="run_local",
                        help="Run local actions only",
                        action="store_true",
                        default=False)
    parser.add_argument("-k",
                        "--apikey",
                        dest="cli_apikeys",
                        help="Pass config options. Format is \"K:V,K:V\"")

    args = parser.parse_args()
    ui.setup(verbose=args.verbosity)  # Show debug messages if -v True
    print_banner()
    main(args)
    ui.info("\n", ui.check, "Done")
Exemple #6
0
def main(args=None):
    parser = argparse.ArgumentParser()

    parser.add_argument("--verbose",
                        help="Show debug messages",
                        action="store_true")
    parser.add_argument("-q",
                        "--quiet",
                        help="Only display warnings and errors",
                        action="store_true")
    parser.add_argument("--color", choices=["auto", "always", "never"])

    subparsers = parser.add_subparsers(title="subcommands", dest="command")

    subparsers.add_parser("version")

    foreach_parser = workspace_subparser(subparsers, "foreach")
    foreach_parser.add_argument("cmd", nargs="*")
    foreach_parser.add_argument("-c", dest="shell", action="store_true")
    foreach_parser.epilog = textwrap.dedent("""\
    Usage:
       # Run command directly
       tsrc foreach -- some-cmd --with-option
    Or:
       # Run command through the shell
       tsrc foreach -c 'some cmd'
    """)
    foreach_parser.formatter_class = argparse.RawDescriptionHelpFormatter

    init_parser = workspace_subparser(subparsers, "init")
    init_parser.add_argument("manifest_url", nargs="?")
    init_parser.add_argument("-b", "--branch")
    init_parser.add_argument("-g", "--group", action="append", dest="groups")
    init_parser.set_defaults(branch="master")

    log_parser = workspace_subparser(subparsers, "log")
    log_parser.add_argument("--from",
                            required=True,
                            dest="from_",
                            metavar="FROM")
    log_parser.add_argument("--to")
    log_parser.set_defaults(to="HEAD")

    push_parser = workspace_subparser(subparsers, "push")
    push_parser.add_argument("--accept", action="store_true", default=False)
    push_parser.add_argument("-f",
                             "--force",
                             action="store_true",
                             default=False)
    push_parser.add_argument("-t",
                             "--target",
                             dest="target_branch",
                             default="master")
    message_group = push_parser.add_mutually_exclusive_group()
    message_group.add_argument("-m", "--message", dest="mr_title")
    message_group.add_argument("--wip",
                               action="store_true",
                               help="Mark merge request as WIP")
    message_group.add_argument("--ready",
                               action="store_true",
                               help="Mark merge request as ready")
    push_parser.add_argument("-a", "--assignee", dest="assignee")
    workspace_subparser(subparsers, "status")
    workspace_subparser(subparsers, "sync")

    args = parser.parse_args(args=args)
    ui.setup(verbose=args.verbose, quiet=args.quiet, color=args.color)

    command = args.command
    if not command:
        parser.print_help()
        sys.exit(1)
    module = importlib.import_module("tsrc.cli.%s" % command)
    if command == "foreach":
        fix_cmd_args_for_foreach(args, foreach_parser)

    return module.main(args)