-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDeployOutput.cpp
More file actions
98 lines (87 loc) · 2.5 KB
/
Copy pathDeployOutput.cpp
File metadata and controls
98 lines (87 loc) · 2.5 KB
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
/**
*
* @file DeployOutput.cpp
* @author Gaspard Kirira
*
* Copyright 2026, Gaspard Kirira. All rights reserved.
* https://github.com/vixcpp/vix
* Use of this source code is governed by a MIT license
* that can be found in the License file.
*
* Vix.cpp
*/
#include <vix/cli/commands/deploy/DeployOutput.hpp>
#include <vix/cli/util/Ui.hpp>
#include <ostream>
#include <string>
namespace vix::commands::deploy::output
{
namespace
{
std::string yes_no(bool value)
{
return value ? "yes" : "no";
}
std::string enabled_disabled(bool value)
{
return value ? "enabled" : "disabled";
}
}
void print_summary(
std::ostream &out,
const DeployConfig &cfg,
const DeployOptions &options)
{
vix::cli::util::section(out, "Deploy");
vix::cli::util::kv(out, "App", cfg.appName);
vix::cli::util::kv(out, "Branch", cfg.branch);
vix::cli::util::kv(out, "Pull", yes_no(cfg.pull));
vix::cli::util::kv(out, "Build", cfg.buildCommand);
vix::cli::util::kv(out, "Tests", enabled_disabled(cfg.tests));
vix::cli::util::kv(out, "Service", cfg.serviceName.empty() ? "(missing)" : cfg.serviceName);
vix::cli::util::kv(out, "Health local", enabled_disabled(cfg.healthLocal));
vix::cli::util::kv(out, "Health public", enabled_disabled(cfg.healthPublic));
vix::cli::util::kv(out, "Proxy check", enabled_disabled(cfg.proxyCheck));
vix::cli::util::kv(out, "Proxy reload", enabled_disabled(cfg.proxyReload));
vix::cli::util::kv(out, "Logs on failure", enabled_disabled(cfg.logsOnFailure));
vix::cli::util::kv(out, "Rollback", enabled_disabled(cfg.rollback));
vix::cli::util::kv(out, "Dry run", yes_no(options.dryRun));
vix::cli::util::kv(out, "Verbose", yes_no(options.verbose));
}
void step(
std::ostream &out,
const std::string &label)
{
vix::cli::util::section(out, label);
}
void command(
std::ostream &out,
const std::string &command)
{
vix::cli::util::kv(out, "Command", command);
}
void ok(
std::ostream &out,
const std::string &message)
{
vix::cli::util::ok_line(out, message);
}
void warn(
std::ostream &out,
const std::string &message)
{
vix::cli::util::warn_line(out, message);
}
void error(
std::ostream &out,
const std::string &message)
{
vix::cli::util::err_line(out, message);
}
void fix(
std::ostream &out,
const std::string &message)
{
vix::cli::util::warn_line(out, "Fix: " + message);
}
}