Skip to content

Commit 0b5896b

Browse files
committed
cli: add modules command (init/add/check) for opt-in Vix modules mode
1 parent 6035f5c commit 0b5896b

4 files changed

Lines changed: 849 additions & 2 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef VIX_MODULES_COMMAND_HPP
2+
#define VIX_MODULES_COMMAND_HPP
3+
4+
#include <string>
5+
#include <vector>
6+
7+
namespace vix::commands::ModulesCommand
8+
{
9+
int run(const std::vector<std::string> &args);
10+
int help();
11+
}
12+
13+
#endif

src/CLI.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <vix/cli/commands/StoreCommand.hpp>
3434
#include <vix/cli/commands/PublishCommand.hpp>
3535
#include <vix/cli/commands/DepsCommand.hpp>
36+
#include <vix/cli/commands/ModulesCommand.hpp>
3637

3738
#include <vix/cli/Style.hpp>
3839
#include <vix/utils/Logger.hpp>
@@ -347,6 +348,8 @@ namespace vix
347348
return commands::PublishCommand::help();
348349
if (cmd == "deps")
349350
return commands::DepsCommand::help();
351+
if (cmd == "modules")
352+
return commands::ModulesCommand::help();
350353
}
351354

352355
#ifndef VIX_CLI_VERSION
@@ -384,6 +387,9 @@ namespace vix
384387
out << indent(3) << "tests [path] Run project tests (alias of check --tests)\n";
385388
out << indent(3) << "repl Start interactive Vix REPL\n\n";
386389

390+
out << indent(2) << "Project structure:\n";
391+
out << indent(3) << "modules <subcommand> Opt-in module system (init/add/check)\n\n";
392+
387393
out << indent(2) << "Registry:\n";
388394
out << indent(3) << "registry <subcommand> Sync/search registry index (git-based)\n";
389395
out << indent(3) << "add <pkg>@<version> Add a dependency from registry (pins commit)\n";
@@ -396,8 +402,8 @@ namespace vix
396402

397403
out << indent(2) << "Packaging & security:\n";
398404
out << indent(3) << "pack [options] Create dist/<name>@<version> (+ optional .vixpkg)\n";
399-
out << indent(3) << "verify [options] Verify dist/<name>@<version> or a .vixpkg artifact\n\n";
400-
out << indent(3) << "install [options] Install dist/<name>@<version> or a .vixpkg into the local store\n";
405+
out << indent(3) << "verify [options] Verify dist/<name>@<version> or a .vixpkg artifact\n";
406+
out << indent(3) << "install [options] Install dist/<name>@<version> or a .vixpkg into the local store\n\n";
401407

402408
out << indent(2) << "Database (ORM):\n";
403409
out << indent(3) << "orm <subcommand> Migrations/status/rollback\n\n";

src/commands/Dispatch.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <vix/cli/commands/StoreCommand.hpp>
3232
#include <vix/cli/commands/PublishCommand.hpp>
3333
#include <vix/cli/commands/DepsCommand.hpp>
34+
#include <vix/cli/commands/ModulesCommand.hpp>
3435

3536
#include <stdexcept>
3637

@@ -204,6 +205,14 @@ namespace vix::cli::dispatch
204205
{ return vix::commands::DepsCommand::run(a); },
205206
[]()
206207
{ return vix::commands::DepsCommand::help(); }});
208+
209+
add({"modules",
210+
"Project",
211+
"Optional project modules (init/add/list/check)",
212+
[](const Args &a)
213+
{ return vix::commands::ModulesCommand::run(a); },
214+
[]()
215+
{ return vix::commands::ModulesCommand::help(); }});
207216
}
208217

209218
bool Dispatcher::has(const std::string &cmd) const

0 commit comments

Comments
 (0)