Skip to content

Save-DbaCommunitySoftware - Accept an array of Software values, add All - #10545

Open
potatoqualitee wants to merge 2 commits into
developmentfrom
worktree-save-community-software-array
Open

Save-DbaCommunitySoftware - Accept an array of Software values, add All#10545
potatoqualitee wants to merge 2 commits into
developmentfrom
worktree-save-community-software-array

Conversation

@potatoqualitee

Copy link
Copy Markdown
Member

Summary

  • -Software now accepts an array ([string[]]), so multiple community tools can be downloaded in one call, with native tab-completion preserved via ValidateSet.
  • Added a new All value that expands to every supported tool.
  • Url, LocalFile and LocalDirectory only describe a single tool, so they now warn and no-op instead of downloading when combined with more than one Software value (including All).
  • Fixed a retry-loop bug where a fully failed download only continued the inner retry loop instead of moving on to the next software item, letting it fall through into Expand-Archive against a missing zip file.
  • Fixed a stale default: dba-multitool's GitHub default branch was renamed from master to main upstream; the hardcoded default here was never updated, so -Software DbaMultiTool (or All) failed without an explicit -Branch main. Found via the new real-download All test.
  • Fixed a blind spot in .claude/hooks/validate-style.ps1: it tracked here-string state but had no equivalent for <# #> block comments (only # line comments), so it mechanically rejected single quotes inside comment-based help text. Added tracking that mirrors the existing here-string state machine.

Test plan

  • Parameter validation tests updated for the array type and All value
  • New real-boundary integration test downloads multiple named tools in one call
  • New real-boundary integration test downloads every tool via -Software All and verifies each one landed
  • Existing LocalDirectory warning tests extended to cover the All case
  • Full Pester suite for this command run locally: 9 passed, 0 failed

-Software now accepts an array to download several community tools in
one call, plus a new All value that expands to every supported tool.
Url, LocalFile and LocalDirectory still only apply to a single tool, so
they now warn and no-op when combined with more than one Software
value, including All.

Also fixes a couple of pre-existing issues surfaced by the new
behavioral coverage:
- A failed download only continued the inner retry loop instead of
  moving on to the next software item, so a fully failed download fell
  through into Expand-Archive against a missing zip file.
- dba-multitool's GitHub default branch was renamed from master to
  main upstream; the hardcoded default here was never updated.

Fixes a blind spot in the style hook while here: validate-style.ps1
had no state tracking for <# #> block comments (only # line comments),
so it mechanically rejected single quotes inside comment-based help.
Added tracking that mirrors the existing here-string state machine.

(do Save-DbaCommunitySoftware)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@SQLDataCloud

Copy link
Copy Markdown

Would it be possible to have something for new SQL builds: Install-DbaCommunitySoftware ?

@potatoqualitee

Copy link
Copy Markdown
Member Author

sure, lez do it @SQLDataCloud

@SQLDataCloud

Copy link
Copy Markdown

My PowerShell isn't brilliant, but happy to help on this where I can. Super curious and geeky to know how a dbatools command is created from the ground up. 🤘🤓

…LocalDirectory tests

Both tests deliberately trigger the "single -Software value" warning and assert it
through $WarnVar, but did not silence it, so a full suite run reported two warnings
for this file. The assertions are unchanged.

(do Save-DbaCommunitySoftware)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants