def main():
  (options, args, ferror) = parse_args()

  if options.subcommand is "install":
    if len(args) != 0:
      ferror("list takes no arguments")
    install(options.show, options.force)
    return

  # Fail fast if we're not in a repo
  repo = open_repo(options.native)

  if options.debug:
    print("repo\t[%s]\t%s" % (repo.active_branch, repo.working_tree_dir))

  if options.subcommand is "list":
    # Fail fast if we don't have an invalid .saplings config
    split_config = open_config(repo)

    if len(args) != 0:
      ferror("list takes no arguments")

    list(repo, split_config, options.verbose)

  elif options.subcommand is "split":
    if options.branch:
      if len(args) == 0:
        ferror("At least 1 split path must be specified")

      try:
        splits = [ saplib.Split(repo, options.branch, args) ]
      except __HOLE__ as e:
        ferror(e)
    else:
      if len(args) == 0:
        ferror("At least 1 split must be specified")

      splits_by_name = open_config(repo).splits
      try:
        splits = [ splits_by_name[name] for name in args ]
      except KeyError as e:
        ferror("Split not defined: %s" % e)

    split(splits, options.verbose, options.dry_run)
dataset/ETHPy150Open jsirois/sapling/sapling.py/main