Skip to content

Commit ff35ca3

Browse files
committed
feat(cli): add 'vix info' with env paths, cache stats and disk usage
2 parents 4bdfb91 + 1df5435 commit ff35ca3

File tree

4 files changed

+431
-0
lines changed

4 files changed

+431
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
*
3+
* @file InfoCommand.hpp
4+
* @author Gaspard Kirira
5+
*
6+
* Copyright 2025, 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_INFO_COMMAND_HPP
14+
#define VIX_INFO_COMMAND_HPP
15+
16+
#include <string>
17+
#include <vector>
18+
19+
namespace vix::commands
20+
{
21+
class InfoCommand
22+
{
23+
public:
24+
static int run(const std::vector<std::string> &args);
25+
static int help();
26+
};
27+
}
28+
29+
#endif

src/CLI.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <vix/cli/commands/OutdatedCommand.hpp>
4444
#include <vix/cli/commands/MakeCommand.hpp>
4545
#include <vix/cli/commands/CompletionCommand.hpp>
46+
#include <vix/cli/commands/InfoCommand.hpp>
4647
#include <vix/utils/Env.hpp>
4748
#include <vix/cli/Style.hpp>
4849
#include <vix/utils/Logger.hpp>
@@ -214,6 +215,8 @@ namespace vix
214215
{ return commands::ReplCommand::run(args); };
215216
commands_["cache"] = [](auto args)
216217
{ return commands::CacheCommand::run(args); };
218+
commands_["info"] = [](auto args)
219+
{ return commands::InfoCommand::run(args); };
217220

218221
commands_["-h"] = [this](auto args)
219222
{ return help(args); };
@@ -467,6 +470,8 @@ namespace vix
467470
return commands::ModulesCommand::help();
468471
if (cmd == "p2p")
469472
return commands::P2PCommand::help();
473+
if (cmd == "info")
474+
return commands::InfoCommand::help();
470475
if (cmd == "upgrade")
471476
return commands::UpgradeCommand::help();
472477
if (cmd == "doctor")
@@ -554,6 +559,7 @@ namespace vix
554559

555560
// System
556561
out << indent(2) << "System:\n";
562+
out << indent(3) << "info Show Vix paths and cache locations\n";
557563
out << indent(3) << "doctor Check environment\n";
558564
out << indent(3) << "upgrade Update Vix\n";
559565
out << indent(3) << "uninstall Remove Vix\n\n";

src/commands/Dispatch.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <vix/cli/commands/MakeCommand.hpp>
4343
#include <vix/cli/util/Ui.hpp>
4444
#include <vix/cli/commands/CompletionCommand.hpp>
45+
#include <vix/cli/commands/InfoCommand.hpp>
4546

4647
#include <stdexcept>
4748

@@ -298,6 +299,14 @@ namespace vix::cli::dispatch
298299
[]()
299300
{ return vix::commands::UpgradeCommand::help(); }});
300301

302+
add({"info",
303+
"Info",
304+
"Show Vix environment and cache locations",
305+
[](const Args &a)
306+
{ return vix::commands::InfoCommand::run(a); },
307+
[]()
308+
{ return vix::commands::InfoCommand::help(); }});
309+
301310
add({"doctor",
302311
"Info",
303312
"Check toolchain and install health",

0 commit comments

Comments
 (0)