aboutsummaryrefslogtreecommitdiff
path: root/load/load.cli
blob: c86df0faa3b1786468ea9886ad7e22f2a07c59f3 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// file      : load/load.cli
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

include <vector>;
include <string>;
include <cstdint>; // uint16_t

include <brep/types>;

"\section=1"
"\name=brep-load"
"\summary=load build2 repositories into database"

{
  "<options> <file>",

  "\h|SYNOPSIS|

   \cb{brep-load --help}\n
   \cb{brep-load --version}\n
   \c{\b{brep-load} [<options>] <file>}

   \h|DESCRIPTION|

   \cb{brep-load} reads the list of repositories from the specified
   configuration <file>, fetches their manifest files, and loads the
   repository and package information into the database, suitable for
   consumption by the \cb{brep} web module.

   Note that \cb{brep-load} expects the database schema to have already been
   created using \l{brep-migrate(1)}.

   Also note that \cb{brep-load} requires \l{bpkg(1)} to fetch repository
   information. See \cb{--bpkg} for more information on the package manager
   program."
}

class options
{
  "\h|OPTIONS|"

  std::string --db-user|-u
  {
    "<user>",
    "Database user name. If not specified, then operating system (login)
     name is used."
  }

  std::string --db-password
  {
    "<pass>",
    "Database password. If not specified, then login without password is
     expected to work."
  }

  std::string --db-name|-n = "brep"
  {
    "<name>",
    "Database name. If not specified, then '\cb{brep}' is used by default."
  }

  std::string --db-host|-h
  {
    "<host>",
    "Database host name, address, or socket. If not specified, then connect
     to \cb{localhost} using the operating system-default mechanism
     (Unix-domain socket, etc)."
  }

  std::uint16_t --db-port|-p = 0
  {
    "<port>",
    "Database port number. If not specified, the default port is used."
  }

  brep::path --bpkg = "bpkg"
  {
    "<path>",
    "The package manager program to be used to fetch repository information.
     This should be the path to the \cb{bpkg} executable. You can also specify
     additional options that should be passed to the package manager program
     with \cb{--bpkg-option}. If the package manager program is not explicitly
     specified, then \cb{brep-load} will use \cb{bpkg} by default."
  }

  brep::strings --bpkg-option
  {
    "<opt>",
    "Additional option to be passed to the package manager program. See
     \cb{--bpkg} for more information on the package manager program. Repeat
     this option to specify multiple package manager options."
  }

  std::string --pager // String to allow empty value.
  {
    "<path>",
    "The pager program to be used to show long text. Commonly used pager
     programs are \cb{less} and \cb{more}. You can also specify additional
     options that should be passed to the pager program with
     \cb{--pager-option}. If an empty string is specified as the pager
     program, then no pager will be used. If the pager program is not
     explicitly specified, then \cb{brep-load} will try to use \cb{less}. If
     it is not available, then no pager will be used."
  }

  std::vector<std::string> --pager-option
  {
    "<opt>",
    "Additional option to be passed to the pager program. See \cb{--pager}
     for more information on the pager program. Repeat this option to
     specify multiple pager options."
  }

  bool --help {"Print usage information and exit."}
  bool --version {"Print version and exit."}
};

"\h|EXIT STATUS|

\cb{0}      Successful termination.

\cb{1}      Fatal error.

\cb{2}      \cb{brep-load} or \l{brep-migrate(1)} instance is running. Try
            again.

\cb{3}      The database recoverable error. Try again.
"