Skip to content

Commit

Permalink
Added ability to skip addons specified by file during install/update/…
Browse files Browse the repository at this point in the history
…uninstall

Also, added ability to specify addons to test or to skip test via file
  • Loading branch information
katyukha committed Oct 6, 2023
1 parent 91e6db7 commit 0352306
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Release 0.0.15 (Unreleased)

### Added

- Added ability skip addons specified in file during install/update/upgrade.
- Added new options to `odood test` command:
- `--file` that could be used to pass the path to file to read addons to test from
- `--skip-file` read names of addons to skip from file

### Changed

- Installation of dependencies from manifest is now optional.
Expand Down
13 changes: 11 additions & 2 deletions subpackages/cli/source/odood/cli/commands/addons.d
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,19 @@ class CommandAddonsUpdateInstallUninstall: OdoodCommand {
this.add(new Option(
null, "dir-r",
"Directory to recursively search for addons").repeating);
this.add(
new Option(
"f", "file",
"Read addons names from file (addon names must be separated by new lines)"
).optional().repeating());
this.add(new Option(
null, "skip", "Skip addon specified by name.").repeating);
this.add(new Option(
null, "skip-re", "Skip addon specified by regex.").repeating);
this.add(
new Option(
"f", "file",
"Read addons names from file (addon names must be separated by new lines)"
null, "skip-file",
"Skip addons listed in specified file (addon names must be separated by new lines)"
).optional().repeating());
this.add(new Argument(
"addon", "Specify names of addons as arguments.").optional.repeating);
Expand All @@ -409,6 +414,10 @@ class CommandAddonsUpdateInstallUninstall: OdoodCommand {
string[] skip_addons = args.options("skip");
auto skip_regexes = args.options("skip-re").map!(r => regex(r)).array;

foreach(path; args.options("skip-file"))
foreach(addon; project.addons.parseAddonsList(Path(path)))
skip_addons ~= addon.name;

OdooAddon[] addons;
foreach(search_path; args.options("dir"))
foreach(addon; project.addons.scan(Path(search_path), false)) {
Expand Down
21 changes: 21 additions & 0 deletions subpackages/cli/source/odood/cli/commands/test.d
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,22 @@ class CommandTest: OdoodCommand {
this.add(new Option(
null, "dir-r",
"Directory to recursively search for addons to test").repeating);
this.add(
new Option(
"f", "file",
"Read addons names from file (addon names must be separated by new lines)"
).optional().repeating());
this.add(new Option(
null, "skip",
"Skip (do not run tests) addon specified by name.").repeating);
this.add(new Option(
null, "skip-re",
"Skip (do not run tests) addon specified by regex.").repeating);
this.add(
new Option(
null, "skip-file",
"Skip addons listed in specified file (addon names must be separated by new lines)"
).optional().repeating());
this.add(new Argument(
"addon", "Name of addon to run tests for.").optional.repeating);

Expand All @@ -93,6 +103,10 @@ class CommandTest: OdoodCommand {
string[] skip_addons = args.options("skip");
auto skip_regexes = args.options("skip-re").map!(r => regex(r)).array;

foreach(path; args.options("skip-file"))
foreach(addon; project.addons.parseAddonsList(Path(path)))
skip_addons ~= addon.name;

OdooAddon[] addons;
foreach(search_path; args.options("dir"))
foreach(addon; project.addons.scan(Path(search_path), false)) {
Expand All @@ -119,6 +133,13 @@ class CommandTest: OdoodCommand {
addons ~= addon.get;
}

foreach(path; args.options("file")) {
foreach(addon; project.addons.parseAddonsList(Path(path))) {
if (skip_addons.canFind(addon.name)) continue;
if (skip_regexes.canFind!((re, addon) => !addon.matchFirst(re).empty)(addon.name)) continue;
addons ~= addon;
}
}
return addons;
}

Expand Down

0 comments on commit 0352306

Please sign in to comment.