Skip to content

Commit 9b3ee62

Browse files
committed
cufetchpm: args: remove --silence-warning and replace with --yes
most short duration feature ever :wilted_rose:
1 parent 97caeb5 commit 9b3ee62

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

cufetchpm/include/pluginManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace fs = std::filesystem;
3939
inline struct operations_t
4040
{
4141
bool install_force = false;
42-
bool install_no_warn = false;
42+
bool install_shut_up = false;
4343
bool list_verbose = false;
4444
std::vector<std::string> arguments;
4545
} options;

cufetchpm/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bool parse_install_args(int argc, char* argv[])
109109
const struct option long_opts[] = {
110110
{"force", no_argument, nullptr, 'f'},
111111
{"help", no_argument, nullptr, 'h'},
112-
{"silence-warning", no_argument, nullptr, 'w'},
112+
{"yes", no_argument, nullptr, 'y'},
113113
{0, 0, 0, 0}
114114
};
115115
// clang-format on
@@ -123,7 +123,7 @@ bool parse_install_args(int argc, char* argv[])
123123
case '?': help_install(EXIT_FAILURE); break;
124124

125125
case 'f': options.install_force = true; break;
126-
case 'w': options.install_no_warn = true; break;
126+
case 'y': options.install_shut_up = true; break;
127127
}
128128
}
129129

cufetchpm/src/pluginManager.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static bool has_deps(const std::vector<std::string>& dependencies)
6262

6363
static bool find_plugin_prefix(const plugin_t& plugin, const plugin_t& pending_plugin)
6464
{
65-
for (const auto& prefix : pending_plugin.prefixes)
65+
for (const std::string& prefix : pending_plugin.prefixes)
6666
if (std::find(plugin.prefixes.begin(), plugin.prefixes.end(), prefix) != plugin.prefixes.end())
6767
return true;
6868
return false;
@@ -178,7 +178,7 @@ void PluginManager::build_plugins(const fs::path& working_dir)
178178
}
179179
}
180180

181-
if (!options.install_no_warn)
181+
if (!options.install_shut_up)
182182
{
183183
warn("{}",
184184
"You should never blindly trust anything in life that you never saw/know about.\n"
@@ -199,9 +199,9 @@ void PluginManager::build_plugins(const fs::path& working_dir)
199199

200200
if (!manifest.get_dependencies().empty())
201201
{
202-
info("The repository {} requires the following dependencies, check if you have them installed:\n {}",
202+
info("The plugin repository {} requires the following dependencies, check if you have them installed:\n {}",
203203
manifest.get_repo_name(), fmt::join(manifest.get_dependencies(), ", "));
204-
if (!askUserYorN(true, "Are these dependencies installed?"))
204+
if (!options.install_shut_up && !askUserYorN(true, "Are these dependencies installed?"))
205205
die("Balling out, re-install the repository again after installing all dependencies.");
206206
}
207207

@@ -230,7 +230,7 @@ void PluginManager::build_plugins(const fs::path& working_dir)
230230
warn("Plugin '{}' has conflicting prefixes with other plugins.", plugin.name);
231231
warn("Check with 'cufetchpm list' the plugins that have one of the following prefixes: {}",
232232
fmt::join(plugin.prefixes, ", "));
233-
if (!askUserYorN(false, "Wanna continue?"))
233+
if (!options.install_shut_up && !askUserYorN(false, "Wanna continue?"))
234234
{
235235
fs::remove_all(working_dir);
236236
die("Balling out");
@@ -283,7 +283,7 @@ void PluginManager::build_plugins(const fs::path& working_dir)
283283
const fs::path& library_config_path = manifest_config_path / library.path().filename();
284284
if (fs::exists(library_config_path) && (!options.install_force || !is_update))
285285
{
286-
if (askUserYorN(false, "Plugin '{}' already exists. Replace it?", library_config_path.string()))
286+
if (options.install_shut_up || askUserYorN(false, "Plugin '{}' already exists. Replace it?", library_config_path.string()))
287287
fs::remove_all(library_config_path);
288288
else
289289
continue;

cufetchpm/src/stateManager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,14 @@ std::vector<manifest_t> StateManager::get_all_repos()
174174

175175
void StateManager::remove_repo(const std::string& repo)
176176
{
177-
toml::table& repo_tbl = *m_state["repositories"].as_table();
178-
if (!repo_tbl.contains(repo))
177+
toml::table* repo_tbl = m_state["repositories"].as_table();
178+
if (!repo_tbl->contains(repo))
179179
return;
180180

181-
repo_tbl.erase(repo);
181+
repo_tbl->erase(repo);
182182
std::stringstream ss;
183+
ss << "# AUTO-GENERATED FILE. DO NOT EDIT THIS FILE.\n";
184+
ss << "# YOU GONNA MESS SHIT UP. unless you know what you doing ofc\n";
183185
ss << m_state;
184186

185187
if (!writeState(ss.str(), m_path))

0 commit comments

Comments
 (0)