aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-command.hxx
blob: b6494915a658c1895fa81ea77b5cf052b99912e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// file      : bpkg/pkg-command.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BPKG_PKG_COMMAND_HXX
#define BPKG_PKG_COMMAND_HXX

#include <bpkg/types.hxx>
#include <bpkg/forward.hxx> // selected_package
#include <bpkg/utility.hxx>

#include <bpkg/configuration-options.hxx>

namespace bpkg
{
  // Common pkg-{update,clean,test,install,...} implementation.
  //
  // If cmd_variant is not empty, then the <cmd>-for-<variant> is performed
  // instead.
  //
  // The command can also be performed recursively for all or immediate
  // dependencies of the specified or all the held packages.
  //
  int
  pkg_command (const string& cmd, // Without the 'pkg-' prefix.
               const configuration_options&,
               const string& cmd_variant,
               bool recursive,
               bool immediate,
               bool all,
               cli::group_scanner& args);

  struct pkg_command_vars
  {
    shared_ptr<selected_package> pkg;
    strings                     vars; // Package-specific command line vars.
  };

  void
  pkg_command (const string& cmd,
               const dir_path& configuration,
               const common_options&,
               const string& cmd_variant,
               const strings& common_vars,
               const vector<pkg_command_vars>&);
}

#endif // BPKG_PKG_COMMAND_HXX