docs: def add(repo_path, dest_path):
      '''
      Registers a git repository with homely so that it will run its `HOMELY.py`
      script on each invocation of `homely update`. `homely add` also immediately
      executes a `homely update` so that the dotfiles are installed straight
      away. If the git repository is hosted online, a local clone will be created
      first.
  
      REPO_PATH
          A path to a local git repository, or the URL for a git repository
          hosted online. If REPO_PATH is a URL, then it should be in a format
          accepted by `git clone`. If REPO_PATH is a URL, you may also specify
          DEST_PATH.
      DEST_PATH
          If REPO_PATH is a URL, then the local clone will be created at
          DEST_PATH. If DEST_PATH is omitted then the path to the local clone
          will be automatically derived from REPO_PATH.
      '''
      mkcfgdir()
      try:
          repo = getrepohandler(repo_path)
      except NotARepo as err:
          echo("ERROR: {}: {}".format(ERR_NOT_A_REPO, err.repo_path))
          sys.exit(1)
  
      # if the repo isn't on disk yet, we'll need to make a local clone of it
      if repo.isremote:
          localrepo, needpull = addfromremote(repo, dest_path)
      elif dest_path:
          raise UsageError("DEST_PATH is only for repos hosted online")
      else:
          try:
              repoid = repo.getrepoid()
          except RepoHasNoCommitsError as err:
              echo("ERROR: {}".format(ERR_NO_COMMITS))
              sys.exit(1)
          localrepo = RepoInfo(repo, repoid, None)
          needpull = False
  
      # if we don't have a local repo, then there is nothing more to do
      if not localrepo:
          return
  
      # remember this new local repo
      with saveconfig(RepoListConfig()) as cfg:
          cfg.add_repo(localrepo)
      success = run_update([localrepo], pullfirst=needpull, cancleanup=True)
      if not success:
          sys.exit(1)