blob: 39008eba2672d3c3dbd75fbac0db3adb7011eb02 (
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
|
// file : bpkg/cfg-info.cxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#include <bpkg/cfg-info.hxx>
#include <iostream> // cout
#include <bpkg/database.hxx>
#include <bpkg/diagnostics.hxx>
using namespace std;
namespace bpkg
{
int
cfg_info (const cfg_info_options& o, cli::scanner&)
{
tracer trace ("cfg_info");
dir_path c (o.directory ());
l4 ([&]{trace << "configuration: " << c;});
database db (c, trace, false /* pre_attach */);
try
{
cout.exceptions (ostream::badbit | ostream::failbit);
cout << "path: " << db.config << endl
<< "uuid: " << db.uuid << endl
<< "type: " << db.type << endl
<< "name: " << (db.name ? *db.name : "") << endl;
}
catch (const io_error&)
{
fail << "unable to write to stdout";
}
return 0;
}
}
|