Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

dm-ctl/: add --more index for query-status command to get full task information(#523) #533

Merged
merged 2 commits into from
Mar 12, 2020
Merged
Changes from all commits
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
11 changes: 9 additions & 2 deletions dm/ctl/master/query_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ type taskInfo struct {
// NewQueryStatusCmd creates a QueryStatus command
func NewQueryStatusCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "query-status [-w worker ...] [task-name]",
Use: "query-status [-w worker ...] [task-name] [--more]",
Short: "query task status",
Run: queryStatusFunc,
}
cmd.Flags().BoolP("more", "", false, "whether to print the detailed task information")
return cmd
}

Expand Down Expand Up @@ -76,7 +77,13 @@ func queryStatusFunc(cmd *cobra.Command, _ []string) {
return
}

if resp.Result && taskName == "" && len(workers) == 0 {
more, err := cmd.Flags().GetBool("more")
if err != nil {
common.PrintLines("%s", errors.ErrorStack(err))
return
}

if resp.Result && taskName == "" && len(workers) == 0 && !more {
result := wrapTaskResult(resp)
common.PrettyPrintInterface(result)
} else {
Expand Down