mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 03:27:02 -07:00
Added ignore_validation flag check and CLI argument
This commit is contained in:
parent
ce347d9b56
commit
c78cdd3da9
1 changed files with 14 additions and 0 deletions
|
|
@ -147,6 +147,13 @@ namespace gdpm::package_manager{
|
||||||
.help("set verbosity level")
|
.help("set verbosity level")
|
||||||
.nargs(nargs_pattern::optional);
|
.nargs(nargs_pattern::optional);
|
||||||
|
|
||||||
|
program.add_argument("--ignore-validation")
|
||||||
|
.action([&](const auto&){ config.ignore_validation = true; })
|
||||||
|
.default_value(false)
|
||||||
|
.implicit_value(true)
|
||||||
|
.help("ignore checking if current directory is a Godot project")
|
||||||
|
.nargs(0);
|
||||||
|
|
||||||
install_command.add_description("install package(s)");
|
install_command.add_description("install package(s)");
|
||||||
install_command.add_argument("packages")
|
install_command.add_argument("packages")
|
||||||
.required()
|
.required()
|
||||||
|
|
@ -409,6 +416,13 @@ namespace gdpm::package_manager{
|
||||||
return log::error_rc(ec::ARGPARSE_ERROR, e.what());
|
return log::error_rc(ec::ARGPARSE_ERROR, e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we're running in a directory with 'project.godot' file */
|
||||||
|
if (!config.ignore_validation) {
|
||||||
|
if(!std::filesystem::exists("project.godot")){
|
||||||
|
return error(ec::FILE_NOT_FOUND, "no 'project.godot' file found in current directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(program.is_subcommand_used(install_command)){
|
if(program.is_subcommand_used(install_command)){
|
||||||
action = action_e::install;
|
action = action_e::install;
|
||||||
// if(install_command.is_used("packages"))
|
// if(install_command.is_used("packages"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue