fix(types): show custom types when daemon is running (#1216)
The `bd types` command only checked `if store != nil` to fetch custom types. In daemon mode, `store` is nil (daemonClient handles RPC instead), so custom types were never displayed even when configured. This caused a mismatch where `bd config get types.custom` showed the correct values but `bd types` showed none. Fix by calling ensureDirectMode() at the start of the command, matching the pattern used by `bd config get`. This falls back from daemon mode to direct storage access when needed. Co-authored-by: Perttulands <perttu.landstrom@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -53,6 +54,13 @@ Examples:
|
||||
bd types --json # Output as JSON
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// Ensure direct mode for database access (types command needs to read config).
|
||||
// In daemon mode, store is nil so custom types would never be fetched.
|
||||
if err := ensureDirectMode("types command requires direct database access"); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Get custom types from config
|
||||
var customTypes []string
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user