Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/dbc/completions/dbc.fish
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ complete -f -c dbc -n '__fish_dbc_using_subcommand search' -s h -d 'Help'
complete -f -c dbc -n '__fish_dbc_using_subcommand search' -l help -d 'Help'
complete -f -c dbc -n '__fish_dbc_using_subcommand search' -s v -d 'Verbose'
complete -f -c dbc -n '__fish_dbc_using_subcommand search' -l json -d 'Print output as JSON instead of plaintext'
complete -f -c dbc -n '__fish_dbc_using_subcommand search' -l pre -d 'Include pre-release drivers and versions (hidden by default)'
complete -f -c dbc -n '__fish_dbc_using_subcommand search' -l pre -d 'Include pre-release drivers and versions (hidden by default unless already installed)'

# remove subcommand
complete -f -c dbc -n '__fish_dbc_using_subcommand remove' -s h -d 'Help'
Expand Down
2 changes: 1 addition & 1 deletion cmd/dbc/completions/dbc.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function _dbc_search_completions {
'(-h)--help[Help]' \
'-v[verbose]' \
'--json[Print output as JSON instead of plaintext]' \
'--pre[Include pre-release drivers and versions (hidden by default)]' \
'--pre[Include pre-release drivers and versions (hidden by default unless already installed)]' \
':search term: '
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/dbc/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type SearchCmd struct {
Verbose bool `arg:"-v" help:"Enable verbose output"`
Json bool `help:"Print output as JSON instead of plaintext"`
Pattern *regexp.Regexp `arg:"positional" help:"Pattern to search for"`
Pre bool `arg:"--pre" help:"Include pre-release drivers and versions (hidden by default)"`
Pre bool `arg:"--pre" help:"Include pre-release drivers and versions (hidden by default unless already installed)"`
}

func (s SearchCmd) GetModelCustom(baseModel baseModel) tea.Model {
Expand Down
37 changes: 37 additions & 0 deletions cmd/dbc/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,43 @@ func (suite *SubcommandTestSuite) TestSearchCmdWithInstalledPre() {
"test-driver-docs-url This is manifest-only with its docs_url key set ", suite.runCmd(m))
}

func (suite *SubcommandTestSuite) TestSearchCmdVerboseWithInstalledPre() {
m := InstallCmd{Driver: "test-driver-only-pre", Level: config.ConfigEnv, Pre: true}.
GetModelCustom(baseModel{getDriverRegistry: getTestDriverRegistry, downloadPkg: downloadTestPkg})
suite.runCmd(m)

// Verbose search WITHOUT --pre: installed pre-release driver should still appear
m = SearchCmd{Verbose: true}.GetModelCustom(
baseModel{getDriverRegistry: getTestDriverRegistry,
downloadPkg: downloadTestPkg})
out := suite.runCmd(m)

suite.Contains(out, "test-driver-only-pre")
suite.Contains(out, "Test Driver Only Prerelease")
suite.Contains(out, "Installed Versions:")
suite.Contains(out, "0.9.0-alpha.1")
suite.Contains(out, "test-driver-1")
suite.Contains(out, "test-driver-2")
}

func (suite *SubcommandTestSuite) TestSearchCmdWithInstalledPreJSON() {
m := InstallCmd{Driver: "test-driver-only-pre", Level: config.ConfigEnv, Pre: true}.
GetModelCustom(baseModel{getDriverRegistry: getTestDriverRegistry, downloadPkg: downloadTestPkg})
suite.runCmd(m)

// JSON search WITHOUT --pre: installed pre-release driver should still appear
m = SearchCmd{Json: true}.GetModelCustom(
baseModel{getDriverRegistry: getTestDriverRegistry,
downloadPkg: downloadTestPkg})
out := suite.runCmd(m)

suite.Contains(out, `"test-driver-only-pre"`)
suite.Contains(out, `"installed"`)
suite.Contains(out, `0.9.0-alpha.1`)
suite.Contains(out, `"test-driver-1"`)
suite.Contains(out, `"test-driver-2"`)
}

func (suite *SubcommandTestSuite) TestSearchCmdPartialRegistryFailure() {
// Test that search command handles partial registry failure gracefully
// (one registry succeeds, another fails - returns both drivers and error)
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/finding_drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ $ dbc search --pre

Without `--pre`, `dbc search` will:

- Hide drivers that have exclusively pre-release versions (no stable versions)
- Hide drivers that have exclusively pre-release versions (no stable versions), unless the driver is already installed
- Exclude pre-release versions from the available versions list

With `--pre`, `dbc search` will:
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $ dbc search [PATTERN]

`--pre` {{ since_version('v0.2.0') }}

: Include pre-release drivers and versions (hidden by default)
: Include pre-release drivers and versions (hidden by default unless already installed)

`--verbose`, `-v`

Expand Down
Loading