예제 #1
0
def main():
    import instaclone

    parser = argparse.ArgumentParser(
        description=DESCRIPTION,
        version=VERSION,
        epilog="\n" + __doc__,
        formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument("command",
                        help="%s command" % NAME,
                        choices=instaclone._command_list)
    parser.add_argument(
        "--config",
        help="config YAML or JSON file to override usual search path")
    parser.add_argument(
        "-f",
        "--force",
        help=
        "force operation, clobbering any existing cached or local targets (use with care)",
        action="store_true")
    parser.add_argument("--debug",
                        help="enable debugging output",
                        action="store_true")
    args = parser.parse_args()

    log_setup(log.DEBUG if args.debug else log.INFO)

    instaclone.run_command(instaclone.Command[args.command],
                           override_path=args.config,
                           force=args.force)
예제 #2
0
파일: main.py 프로젝트: jlevy/instaclone
def main():
  import instaclone

  parser = argparse.ArgumentParser(description=DESCRIPTION, version=VERSION, epilog="\n" + __doc__,
                                   formatter_class=argparse.RawTextHelpFormatter)
  parser.add_argument("command", help="%s command" % NAME, choices=instaclone._command_list)
  parser.add_argument("--config", help="config YAML or JSON file to override usual search path")
  parser.add_argument("-f", "--force",
                      help="force operation, clobbering any existing cached or local targets (use with care)",
                      action="store_true")
  parser.add_argument("--debug", help="enable debugging output", action="store_true")
  args = parser.parse_args()

  log_setup(log.DEBUG if args.debug else log.INFO)

  instaclone.run_command(instaclone.Command[args.command], override_path=args.config, force=args.force)
예제 #3
0
파일: main.py 프로젝트: vivlabs/instaclone
def main():
  import instaclone
  import configs

  config_docs = "Setting file keys:\n\n%s\n" % (
    "\n".join(["  %s: %s" % (k, v) for (k, v) in configs.CONFIG_DESCRIPTIONS.iteritems()]))

  parser = argparse.ArgumentParser(description=DESCRIPTION, version=VERSION, epilog="\n" + config_docs + __doc__,
                                   formatter_class=argparse.RawTextHelpFormatter)
  parser.add_argument("command", help="%s command" % NAME, choices=instaclone._command_list)
  parser.add_argument("items", help="optional subset of local paths to install", nargs="*")
  parser.add_argument("--config", help="YAML or JSON file to use (overrides usual search path)")
  parser.add_argument("-f", "--force",
                      help="force operation, clobbering any existing cached or local targets (use with care)",
                      action="store_true")
  parser.add_argument("--copy",
                      help="override: use install_method=fastcopy for all items",
                      action="store_true")
  parser.add_argument("--debug", help="enable debugging output", action="store_true")

  # XXX Unfortunately the setting "version" conflicts with argparse's --version.
  for (key, desc) in configs.CONFIG_DESCRIPTIONS.iteritems():
    parser.add_argument("--" + key.replace("_", "-"), metavar="S", help="setting override (single item)")

  args = parser.parse_args()

  overrides = {}
  for key in configs.CONFIG_OVERRIDABLE:
    value = args.__dict__.get(key)
    if value is not None:
      if len(args.items) == 1:
        overrides[key.replace("-", "_")] = value
      else:
        raise ValueError("Must specify just one item when using override '%s'" % key)

  # These overrides can be applied to _all_ items.
  if args.copy:
    overrides["install_method"] = "fastcopy"

  log_setup(log.DEBUG if args.debug else log.INFO)

  log.debug("command-line overrides: %r", overrides)

  instaclone.run_command(instaclone.Command[args.command], override_path=args.config, overrides=overrides,
                         force=args.force, items=args.items)
예제 #4
0
def main():
    import instaclone
    import configs

    config_docs = "Setting file keys:\n\n%s\n" % ("\n".join([
        "  %s: %s" % (k, v)
        for (k, v) in configs.CONFIG_DESCRIPTIONS.iteritems()
    ]))

    parser = argparse.ArgumentParser(
        description=DESCRIPTION,
        version=VERSION,
        epilog="\n" + config_docs + __doc__,
        formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument("command",
                        help="%s command" % NAME,
                        choices=instaclone._command_list)
    parser.add_argument("items",
                        help="optional subset of local paths to install",
                        nargs="*")
    parser.add_argument(
        "--config",
        help="YAML or JSON file to use (overrides usual search path)")
    parser.add_argument(
        "-f",
        "--force",
        help=
        "force operation, clobbering any existing cached or local targets (use with care)",
        action="store_true")
    parser.add_argument(
        "--copy",
        help="override: use install_method=fastcopy for all items",
        action="store_true")
    parser.add_argument("--debug",
                        help="enable debugging output",
                        action="store_true")

    # XXX Unfortunately the setting "version" conflicts with argparse's --version.
    for (key, desc) in configs.CONFIG_DESCRIPTIONS.iteritems():
        parser.add_argument("--" + key.replace("_", "-"),
                            metavar="S",
                            help="setting override (single item)")

    args = parser.parse_args()

    overrides = {}
    for key in configs.CONFIG_OVERRIDABLE:
        value = args.__dict__.get(key)
        if value is not None:
            if len(args.items) == 1:
                overrides[key.replace("-", "_")] = value
            else:
                raise ValueError(
                    "Must specify just one item when using override '%s'" %
                    key)

    # These overrides can be applied to _all_ items.
    if args.copy:
        overrides["install_method"] = "fastcopy"

    log_setup(log.DEBUG if args.debug else log.INFO)

    log.debug("command-line overrides: %r", overrides)

    instaclone.run_command(instaclone.Command[args.command],
                           override_path=args.config,
                           overrides=overrides,
                           force=args.force,
                           items=args.items)