Skip to content

Commit 5d74ee2

Browse files
committed
feat(update): add full update command with add-style specs and CLI integration
- introduce UpdateCommand with support for: • full update (all dependencies) • targeted update (one or more packages) • add-style specs (@namespace/name[@Version]) • options: --dry-run, --json, --install - reuse AddCommand for version resolution and installation - validate targets against vix.lock before updating - integrate command into Dispatcher and CLI help - update CLI help output for better discoverability Enables 'vix update' as a first-class dependency management command.
1 parent a1b2c07 commit 5d74ee2

4 files changed

Lines changed: 561 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
*
3+
* @file UpdateCommand.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+
*/
14+
#ifndef VIX_UPDATE_COMMAND_HPP
15+
#define VIX_UPDATE_COMMAND_HPP
16+
17+
#include <string>
18+
#include <vector>
19+
20+
namespace vix::commands
21+
{
22+
struct UpdateCommand
23+
{
24+
static int run(const std::vector<std::string> &args);
25+
static int help();
26+
};
27+
}
28+
29+
#endif

src/CLI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <vix/cli/commands/DoctorCommand.hpp>
4040
#include <vix/cli/commands/UninstallCommand.hpp>
4141
#include <vix/cli/commands/UnpublishCommand.hpp>
42+
#include <vix/cli/commands/UpdateCommand.hpp>
4243
#include <vix/utils/Env.hpp>
4344
#include <vix/cli/Style.hpp>
4445
#include <vix/utils/Logger.hpp>
@@ -353,6 +354,8 @@ namespace vix
353354
return commands::RegistryCommand::help();
354355
if (cmd == "add")
355356
return commands::AddCommand::help();
357+
if (cmd == "update")
358+
return commands::UpdateCommand::help();
356359
if (cmd == "search")
357360
return commands::SearchCommand::help();
358361
if (cmd == "remove")
@@ -436,6 +439,7 @@ namespace vix
436439
docs("https://vixcpp.com/docs/modules/cli/search");
437440
out << indent(3) << "add <pkg>@<ver> Add dependency\n";
438441
out << indent(3) << "install Install dependencies\n";
442+
out << indent(3) << "update Update dependencies\n";
439443
out << indent(3) << "i Alias for install\n";
440444
out << indent(3) << "deps Legacy alias for install\n";
441445
out << indent(3) << "remove <pkg> Remove dependency\n";

src/commands/Dispatch.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <vix/cli/commands/DoctorCommand.hpp>
3838
#include <vix/cli/commands/UninstallCommand.hpp>
3939
#include <vix/cli/commands/UnpublishCommand.hpp>
40+
#include <vix/cli/commands/UpdateCommand.hpp>
4041
#include <vix/cli/util/Ui.hpp>
4142

4243
#include <stdexcept>
@@ -196,6 +197,22 @@ namespace vix::cli::dispatch
196197
[]()
197198
{ return vix::commands::ListCommand::help(); }});
198199

200+
add({"update",
201+
"Registry",
202+
"Update all dependencies to latest versions",
203+
[](const Args &a)
204+
{ return vix::commands::UpdateCommand::run(a); },
205+
[]()
206+
{ return vix::commands::UpdateCommand::help(); }});
207+
208+
add({"up",
209+
"Registry",
210+
"Alias for update",
211+
[](const Args &a)
212+
{ return vix::commands::UpdateCommand::run(a); },
213+
[]()
214+
{ return vix::commands::UpdateCommand::help(); }});
215+
199216
add({"store",
200217
"Registry",
201218
"Manage local store cache (gc/path)",

0 commit comments

Comments
 (0)