Add substring ID matching for all bd commands
- Enhanced ResolvePartialID to handle: - Bare hashes: 07b8c8 → bd-07b8c8 - Prefix without hyphen: bd07b8c8 → bd-07b8c8 - Full IDs: bd-07b8c8 (unchanged) - Substring matching: 07b → finds bd-07b8c8 - Added RPC support: - New OpResolveID operation - handleResolveID server handler - ResolveID client method - Updated all commands to resolve IDs: - show, update, close, reopen - dep (add, remove, tree) - label (add, remove, list) - Works in both daemon and direct modes Fixes bd-0591c3
This commit is contained in:
+23
-1
@@ -24,11 +24,33 @@ This is more explicit than 'bd update --status open' and emits a Reopened event.
|
||||
reason, _ := cmd.Flags().GetString("reason")
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// Resolve partial IDs first
|
||||
var resolvedIDs []string
|
||||
if daemonClient != nil {
|
||||
for _, id := range args {
|
||||
resolveArgs := &rpc.ResolveIDArgs{ID: id}
|
||||
resp, err := daemonClient.ResolveID(resolveArgs)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error resolving ID %s: %v\n", id, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
resolvedIDs = append(resolvedIDs, string(resp.Data))
|
||||
}
|
||||
} else {
|
||||
var err error
|
||||
resolvedIDs, err = utils.ResolvePartialIDs(ctx, store, args)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
reopenedIssues := []*types.Issue{}
|
||||
|
||||
// If daemon is running, use RPC
|
||||
if daemonClient != nil {
|
||||
for _, id := range args {
|
||||
for _, id := range resolvedIDs {
|
||||
openStatus := string(types.StatusOpen)
|
||||
updateArgs := &rpc.UpdateArgs{
|
||||
ID: id,
|
||||
|
||||
Reference in New Issue
Block a user