-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProductionCommand.cpp
More file actions
70 lines (59 loc) · 1.68 KB
/
Copy pathProductionCommand.cpp
File metadata and controls
70 lines (59 loc) · 1.68 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
/**
*
* @file ProductionCommand.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/ProductionCommand.hpp>
#include <vix/cli/commands/production/ProductionOutput.hpp>
#include <vix/cli/commands/production/ProductionValidator.hpp>
#include <iostream>
#include <string>
#include <vector>
namespace vix::commands
{
int ProductionCommand::run(const std::vector<std::string> &args)
{
#ifndef __linux__
(void)args;
production::output::error(
std::cerr,
"vix production is currently supported on Linux only.");
return 1;
#else
if (args.empty() || args[0] == "-h" || args[0] == "--help")
return help();
const std::string action = args[0];
if (action == "status")
return production::validator::status();
if (action == "validate")
return production::validator::validate();
production::output::error(
std::cerr,
"unknown production command: " + action);
production::output::fix(
std::cerr,
"vix production --help");
return 1;
#endif
}
int ProductionCommand::help()
{
std::cout
<< "Usage:\n"
<< " vix production <command>\n\n"
<< "Commands:\n"
<< " status Show production service, health, proxy and logs status\n"
<< " validate Validate production config using deploy, proxy and health checks\n\n"
<< "Examples:\n"
<< " vix production status\n"
<< " vix production validate\n";
return 0;
}
}