// file      : bpkg/pkg-uninstall.cli
// license   : MIT; see accompanying LICENSE file

include <bpkg/configuration.cli>;

"\section=1"
"\name=bpkg-pkg-uninstall"
"\summary=uninstall package"

namespace bpkg
{
  {
    "<options> <vars> <pkg>",

    "\h|SYNOPSIS|

     \c{\b{bpkg pkg-uninstall}|\b{uninstall} [<options>] [<vars>] <pkg>...\n
        \b{bpkg pkg-uninstall}|\b{uninstall} [<options>] [<vars>] \b{--all}|\b{-a}\n
        \b{bpkg pkg-uninstall}|\b{uninstall} [<options>] [<vars>] (\b{--all-pattern} <pattern>)...}

     \h|DESCRIPTION|

     The \cb{pkg-uninstall} command uninstalls the specified packages (the
     first form), all the held packages (the second form, see
     \l{bpkg-pkg-status(1)}), or all the held packages that match any of the
     specified wildcard patterns (the third form). Additionally, immediate or
     all dependencies of these specified packages can be also uninstalled by
     specifying the \c{\b{--immediate}|\b{-i}} or \c{\b{--recursive}|\b{-r}}
     options, respectively. Underneath, this command doesn't do much more than
     run \cb{b uninstall}. In the first form the specified packages must have
     been previously configured with \l{bpkg-pkg-build(1)} or
     \l{bpkg-pkg-configure(1)}.

     Additional command line variables (<vars>, normally \cb{config.*}) can be
     passed to the build system. Such variables apply to all the specified
     packages but can also be specified to only apply to specific packages
     using the argument grouping mechanism (see \l{bpkg-argument-grouping(1)}
     for details). See \l{bpkg-pkg-install(1)} for some examples."
  }

  class pkg_uninstall_options: configuration_options
  {
    "\h|PKG-UNINSTALL OPTIONS|"

    bool --all|-a
    {
      "Uninstall all held packages."
    }

    strings --all-pattern
    {
      "<pattern>",
      "Uninstall held packages that match the specified wildcard pattern.
       Repeat this option to match multiple patterns. Note that you may need
       to quote the pattern to prevent expansion by your shell."
    }

    bool --immediate|-i
    {
      "Also uninstall immediate dependencies."
    }

    bool --recursive|-r
    {
      "Also uninstall all dependencies, recursively."
    }
  };

  "
   \h|DEFAULT OPTIONS FILES|

   See \l{bpkg-default-options-files(1)} for an overview of the default
   options files. For the \cb{pkg-uninstall} 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-pkg-uninstall.options
   \

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

   \
   --directory|-d
   \
  "
}
