-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathResetCommand.cpp
More file actions
71 lines (61 loc) · 1.79 KB
/
Copy pathResetCommand.cpp
File metadata and controls
71 lines (61 loc) · 1.79 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
71
/**
*
* @file ResetCommand.cpp
* @author Gaspard Kirira
*
* Copyright 2025, 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/ResetCommand.hpp>
#include <vix/cli/commands/CleanCommand.hpp>
#include <vix/cli/commands/InstallCommand.hpp>
#include <vix/cli/util/Ui.hpp>
#include <iostream>
#include <vector>
#include <string>
namespace vix::commands
{
int ResetCommand::run(const std::vector<std::string> &args)
{
if (!args.empty())
return help();
vix::cli::util::section(std::cout, "Reset");
vix::cli::util::info_line(std::cout, "cleaning project cache...");
const int cleanRc = CleanCommand::run({});
if (cleanRc != 0)
{
vix::cli::util::err_line(std::cerr, "reset failed during clean");
return cleanRc;
}
vix::cli::util::one_line_spacer(std::cout);
vix::cli::util::info_line(std::cout, "reinstalling project dependencies...");
const int installRc = InstallCommand::run({});
if (installRc != 0)
{
vix::cli::util::err_line(std::cerr, "reset failed during install");
return installRc;
}
vix::cli::util::one_line_spacer(std::cout);
vix::cli::util::ok_line(std::cout, "Project reset complete");
return 0;
}
int ResetCommand::help()
{
std::cout
<< "vix reset\n"
<< "Reset the local project state.\n\n"
<< "Usage\n"
<< " vix reset\n\n"
<< "What it does\n"
<< " • Runs 'vix clean'\n"
<< " • Runs 'vix install'\n\n"
<< "Notes\n"
<< " • Only affects the current project\n"
<< " • Does NOT remove the global Vix directory (~/.vix)\n";
return 0;
}
}