Skip to content

Commit a09c7da

Browse files
committed
feat(cli): add service management command
1 parent f0d2079 commit a09c7da

4 files changed

Lines changed: 585 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
*
3+
* @file ServiceCommand.hpp
4+
* @author Gaspard Kirira
5+
*
6+
* Copyright 2026, Gaspard Kirira. All rights reserved.
7+
* https://github.com/vixcpp/vix
8+
* Use of this source code is governed by a MIT license
9+
* that can be found in the License file.
10+
*
11+
* Vix.cpp
12+
*/
13+
#ifndef VIX_SERVICE_COMMAND_HPP
14+
#define VIX_SERVICE_COMMAND_HPP
15+
16+
#include <string>
17+
#include <vector>
18+
19+
namespace vix::commands
20+
{
21+
struct ServiceCommand
22+
{
23+
static int run(const std::vector<std::string> &args);
24+
static int help();
25+
};
26+
}
27+
28+
#endif

src/CLI.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <vix/cli/commands/CleanCommand.hpp>
5050
#include <vix/cli/commands/ResetCommand.hpp>
5151
#include <vix/cli/commands/TaskCommand.hpp>
52+
#include <vix/cli/commands/ServiceCommand.hpp>
5253
#include <vix/cli/commands/AgentCommand.hpp>
5354
#include <vix/cli/commands/GameExportCommand.hpp>
5455
#include <vix/utils/Env.hpp>
@@ -284,6 +285,8 @@ namespace vix
284285
{ return commands::ResetCommand::run(args); };
285286
commands_["task"] = [](auto args)
286287
{ return commands::TaskCommand::run(args); };
288+
commands_["service"] = [](auto args)
289+
{ return commands::ServiceCommand::run(args); };
287290
commands_["agent"] = [](auto args)
288291
{ return commands::AgentCommand::run(args); };
289292
commands_["game"] = [](auto args)
@@ -510,6 +513,8 @@ namespace vix
510513
return commands::ResetCommand::help();
511514
if (cmd == "task")
512515
return commands::TaskCommand::help();
516+
if (cmd == "service")
517+
return commands::ServiceCommand::help();
513518
if (cmd == "modules")
514519
return commands::ModulesCommand::help();
515520
if (cmd == "game")
@@ -632,6 +637,7 @@ namespace vix
632637
out << indent(3) << "clean Remove local cache directories\n";
633638
out << indent(3) << "reset Clean cache and reinstall dependencies\n";
634639
out << indent(3) << "task Run reusable project tasks\n";
640+
out << indent(3) << "service Install and manage a production systemd service\n";
635641
out << indent(3) << "modules Manage optional project modules\n\n";
636642

637643
out << indent(2) << "Registry and dependencies:\n";

src/commands/Dispatch.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include <vix/cli/commands/CleanCommand.hpp>
4949
#include <vix/cli/commands/ResetCommand.hpp>
5050
#include <vix/cli/commands/TaskCommand.hpp>
51+
#include <vix/cli/commands/ServiceCommand.hpp>
5152
#include <vix/cli/commands/AgentCommand.hpp>
5253
#include <vix/cli/commands/GameExportCommand.hpp>
5354

@@ -207,6 +208,14 @@ namespace vix::cli::dispatch
207208
[]()
208209
{ return vix::commands::TaskCommand::help(); }});
209210

211+
add({"service",
212+
"Project",
213+
"Install and manage a production systemd service",
214+
[](const Args &a)
215+
{ return vix::commands::ServiceCommand::run(a); },
216+
[]()
217+
{ return vix::commands::ServiceCommand::help(); }});
218+
210219
// Packaging & security
211220
add({"pack",
212221
"Packaging",

0 commit comments

Comments
 (0)