// file      : bpkg/rep-add.cli
// license   : MIT; see accompanying LICENSE file

include <libbpkg/manifest.hxx>;

include <bpkg/configuration.cli>;

"\section=1"
"\name=bpkg-rep-add"
"\summary=add repository to configuration"

namespace bpkg
{
  {
    "<options> <rep-loc> <tag> <branch> <commit-id>",

    "\h|SYNOPSIS|

     \c{\b{bpkg rep-add}|\b{add} [<options>] <rep-loc>...}

     \h|DESCRIPTION|

     The \cb{rep-add} command adds the specified package repositories to the
     configuration. The repository location <rep-loc> is a URL or a directory
     path. If a repository with the same canonical name already exists in the
     configuration, then its location is replaced with the specified.

     Note that this command doesn't fetch the list of available packages for
     the newly added repository. For that, use the \l{bpkg-rep-fetch(1)}
     command, normally, after adding all the repositories you wish to use.

     Currently three types of repositories are supported: archive-based
     \cb{pkg}, directory-based \cb{dir}, and version control-based \cb{git}.
     See \l{bpkg-repository-types(1)} for details on their structure and URL
     format.

     Normally the repository type can be automatically guessed by examining
     its URL (for example, the presence of the \cb{.git} extension) or, in
     case of a local repository, its content (for example, the presence of the
     \cb{.git/} subdirectory). Without any identifying information the
     \cb{pkg} type is assumed unless explicitly specified with the \cb{--type}
     option or in the URL scheme. Note, however, that the \cb{dir} repository
     type is never guessed since it is not easily distinguishable from local
     \cb{pkg} and \cb{git} repositories.
     "
  }

  class rep_add_options: configuration_options
  {
    "\h|REP-ADD OPTIONS|"

    repository_type --type
    {
      "<type>",
      "Specify the repository type with valid values being \cb{pkg}, \cb{dir},
       and \cb{git}."
    }
  };

  "
   \h|DEFAULT OPTIONS FILES|

   See \l{bpkg-default-options-files(1)} for an overview of the default
   options files. For the \cb{rep-add} command the search start
   directory is the configuration directory. The following options files are
   searched for in each directory and, if found, loaded in the order listed:

   \
   bpkg.options
   bpkg-rep-add.options
   \

   The following \cb{rep-add} command options cannot be specified in the
   default options files:

   \
   --directory|-d
   \
  "
}
