From 4c39a6b1acadfacbf27b306e866aa52aab48b7da Mon Sep 17 00:00:00 2001 From: Xuecheng Zhang Date: Wed, 18 Sep 2019 10:14:26 +0800 Subject: [PATCH] *: refine dmctl output for `DM-master`, `task-name` and `config-file` (#291) --- dm/ctl/master/check_task.go | 2 +- dm/ctl/master/pause_task.go | 2 +- dm/ctl/master/query_error.go | 2 +- dm/ctl/master/query_status.go | 2 +- dm/ctl/master/resume_task.go | 2 +- dm/ctl/master/show_ddl_locks.go | 2 +- dm/ctl/master/sql_inject.go | 4 ++-- dm/ctl/master/start_task.go | 2 +- dm/ctl/master/stop_task.go | 2 +- dm/ctl/master/update_masterconfig.go | 4 ++-- dm/ctl/master/update_relay.go | 2 +- dm/ctl/master/update_task.go | 2 +- tests/dmctl_advance/check_list/query_error.sh | 2 +- tests/dmctl_basic/check_list/check_task.sh | 2 +- tests/dmctl_basic/check_list/pause_task.sh | 2 +- tests/dmctl_basic/check_list/query_status.sh | 2 +- tests/dmctl_basic/check_list/resume_task.sh | 2 +- tests/dmctl_basic/check_list/show_ddl_locks.sh | 6 +++--- tests/dmctl_basic/check_list/start_task.sh | 2 +- tests/dmctl_basic/check_list/stop_task.sh | 2 +- tests/dmctl_basic/check_list/update_master_config.sh | 2 +- tests/dmctl_basic/check_list/update_relay.sh | 2 +- tests/dmctl_basic/check_list/update_task.sh | 2 +- 23 files changed, 27 insertions(+), 27 deletions(-) diff --git a/dm/ctl/master/check_task.go b/dm/ctl/master/check_task.go index daebb69c78..1b6a4759b4 100644 --- a/dm/ctl/master/check_task.go +++ b/dm/ctl/master/check_task.go @@ -28,7 +28,7 @@ import ( // NewCheckTaskCmd creates a CheckTask command func NewCheckTaskCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "check-task ", + Use: "check-task ", Short: "check a task with config file", Run: checkTaskFunc, } diff --git a/dm/ctl/master/pause_task.go b/dm/ctl/master/pause_task.go index 154b9d4f54..b1204b42c1 100644 --- a/dm/ctl/master/pause_task.go +++ b/dm/ctl/master/pause_task.go @@ -26,7 +26,7 @@ import ( // NewPauseTaskCmd creates a PauseTask command func NewPauseTaskCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "pause-task [-w worker ...] ", + Use: "pause-task [-w worker ...] ", Short: "pause a running task with name", Run: pauseTaskFunc, } diff --git a/dm/ctl/master/query_error.go b/dm/ctl/master/query_error.go index d218fcb0c0..396a9195b7 100644 --- a/dm/ctl/master/query_error.go +++ b/dm/ctl/master/query_error.go @@ -27,7 +27,7 @@ import ( // NewQueryErrorCmd creates a QueryError command func NewQueryErrorCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "query-error [-w worker ...] [task_name]", + Use: "query-error [-w worker ...] [task-name]", Short: "query task's error", Run: queryErrorFunc, } diff --git a/dm/ctl/master/query_status.go b/dm/ctl/master/query_status.go index 14597079f7..569fe90215 100644 --- a/dm/ctl/master/query_status.go +++ b/dm/ctl/master/query_status.go @@ -27,7 +27,7 @@ import ( // 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]", Short: "query task's status", Run: queryStatusFunc, } diff --git a/dm/ctl/master/resume_task.go b/dm/ctl/master/resume_task.go index 1bdf88aba9..5319adbf23 100644 --- a/dm/ctl/master/resume_task.go +++ b/dm/ctl/master/resume_task.go @@ -26,7 +26,7 @@ import ( // NewResumeTaskCmd creates a ResumeTask command func NewResumeTaskCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "resume-task [-w worker ...] ", + Use: "resume-task [-w worker ...] ", Short: "resume a paused task with name", Run: resumeTaskFunc, } diff --git a/dm/ctl/master/show_ddl_locks.go b/dm/ctl/master/show_ddl_locks.go index 6e0f6e951a..78b5fbe922 100644 --- a/dm/ctl/master/show_ddl_locks.go +++ b/dm/ctl/master/show_ddl_locks.go @@ -27,7 +27,7 @@ import ( // NewShowDDLLocksCmd creates a ShowDDlLocks command func NewShowDDLLocksCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "show-ddl-locks [-w worker ...] [task_name]", + Use: "show-ddl-locks [-w worker ...] [task-name]", Short: "show un-resolved DDL locks", Run: showDDLLocksFunc, } diff --git a/dm/ctl/master/sql_inject.go b/dm/ctl/master/sql_inject.go index 4e17c67196..cfd1d2d825 100644 --- a/dm/ctl/master/sql_inject.go +++ b/dm/ctl/master/sql_inject.go @@ -28,7 +28,7 @@ import ( // NewSQLInjectCmd creates a SQLInject command func NewSQLInjectCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "sql-inject <-w worker> ", + Use: "sql-inject <-w worker> ", Short: "sql-inject injects (limited) sqls into syncer as binlog event", Run: sqlInjectFunc, } @@ -54,7 +54,7 @@ func sqlInjectFunc(cmd *cobra.Command, _ []string) { taskName := cmd.Flags().Arg(0) if strings.TrimSpace(taskName) == "" { - common.PrintLines("task_name is empty") + common.PrintLines("task-name is empty") return } diff --git a/dm/ctl/master/start_task.go b/dm/ctl/master/start_task.go index 7b26588e13..0e385435b1 100644 --- a/dm/ctl/master/start_task.go +++ b/dm/ctl/master/start_task.go @@ -28,7 +28,7 @@ import ( // NewStartTaskCmd creates a StartTask command func NewStartTaskCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "start-task [-w worker ...] ", + Use: "start-task [-w worker ...] ", Short: "start a task with config file", Run: startTaskFunc, } diff --git a/dm/ctl/master/stop_task.go b/dm/ctl/master/stop_task.go index 6252f57941..785281b359 100644 --- a/dm/ctl/master/stop_task.go +++ b/dm/ctl/master/stop_task.go @@ -26,7 +26,7 @@ import ( // NewStopTaskCmd creates a StopTask command func NewStopTaskCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "stop-task [-w worker ...] ", + Use: "stop-task [-w worker ...] ", Short: "stop a task with name", Run: stopTaskFunc, } diff --git a/dm/ctl/master/update_masterconfig.go b/dm/ctl/master/update_masterconfig.go index 00a312b08d..d70111a3b7 100644 --- a/dm/ctl/master/update_masterconfig.go +++ b/dm/ctl/master/update_masterconfig.go @@ -27,8 +27,8 @@ import ( // NewUpdateMasterConfigCmd creates a UpdateMasterConfig command func NewUpdateMasterConfigCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "update-master-config ", - Short: "update configure of dm-master", + Use: "update-master-config ", + Short: "update configure of DM-master", Run: updateMasterConfigFunc, } return cmd diff --git a/dm/ctl/master/update_relay.go b/dm/ctl/master/update_relay.go index 2b76684d9b..e409ad0a47 100644 --- a/dm/ctl/master/update_relay.go +++ b/dm/ctl/master/update_relay.go @@ -27,7 +27,7 @@ import ( // NewUpdateRelayCmd creates a UpdateRelay command func NewUpdateRelayCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "update-relay [-w worker ...] ", + Use: "update-relay [-w worker ...] ", Short: "update dm-worker's relay unit configure", Run: updateRelayFunc, } diff --git a/dm/ctl/master/update_task.go b/dm/ctl/master/update_task.go index e21597623c..09bc934487 100644 --- a/dm/ctl/master/update_task.go +++ b/dm/ctl/master/update_task.go @@ -28,7 +28,7 @@ import ( // NewUpdateTaskCmd creates a UpdateTask command func NewUpdateTaskCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "update-task [-w worker ...] ", + Use: "update-task [-w worker ...] ", Short: "update a task's config for routes, filters, column-mappings, black-white-list", Run: updateTaskFunc, } diff --git a/tests/dmctl_advance/check_list/query_error.sh b/tests/dmctl_advance/check_list/query_error.sh index 0e8d5b43dc..881e84e1c7 100644 --- a/tests/dmctl_advance/check_list/query_error.sh +++ b/tests/dmctl_advance/check_list/query_error.sh @@ -3,7 +3,7 @@ function query_error_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-error wrong_args_count more_than_one" \ - "query-error \[-w worker ...\] \[task_name\]" 1 + "query-error \[-w worker ...\] \[task-name\]" 1 } function query_error_while_master_down() { diff --git a/tests/dmctl_basic/check_list/check_task.sh b/tests/dmctl_basic/check_list/check_task.sh index c1b873ab67..2ddfae0640 100644 --- a/tests/dmctl_basic/check_list/check_task.sh +++ b/tests/dmctl_basic/check_list/check_task.sh @@ -3,7 +3,7 @@ function check_task_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "check-task" \ - "check-task \[flags\]" 1 + "check-task \[flags\]" 1 } function check_task_wrong_config_file() { diff --git a/tests/dmctl_basic/check_list/pause_task.sh b/tests/dmctl_basic/check_list/pause_task.sh index 1c7fdcad60..ffae603e2f 100644 --- a/tests/dmctl_basic/check_list/pause_task.sh +++ b/tests/dmctl_basic/check_list/pause_task.sh @@ -3,7 +3,7 @@ function pause_task_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "pause-task" \ - "pause-task \[-w worker ...\] \[flags\]" 1 + "pause-task \[-w worker ...\] \[flags\]" 1 } function pause_task_while_master_down() { diff --git a/tests/dmctl_basic/check_list/query_status.sh b/tests/dmctl_basic/check_list/query_status.sh index 7a9584261e..ba9b979485 100644 --- a/tests/dmctl_basic/check_list/query_status.sh +++ b/tests/dmctl_basic/check_list/query_status.sh @@ -3,7 +3,7 @@ function query_status_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-status wrong_args_count more_than_one" \ - "query-status \[-w worker ...\] \[task_name\]" 1 + "query-status \[-w worker ...\] \[task-name\]" 1 } function query_status_wrong_params() { diff --git a/tests/dmctl_basic/check_list/resume_task.sh b/tests/dmctl_basic/check_list/resume_task.sh index 57cfb92053..cdc2730228 100644 --- a/tests/dmctl_basic/check_list/resume_task.sh +++ b/tests/dmctl_basic/check_list/resume_task.sh @@ -3,7 +3,7 @@ function resume_task_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "resume-task" \ - "resume-task \[-w worker ...\] \[flags\]" 1 + "resume-task \[-w worker ...\] \[flags\]" 1 } function resume_task_while_master_down() { diff --git a/tests/dmctl_basic/check_list/show_ddl_locks.sh b/tests/dmctl_basic/check_list/show_ddl_locks.sh index e9c540eaa1..257610de54 100644 --- a/tests/dmctl_basic/check_list/show_ddl_locks.sh +++ b/tests/dmctl_basic/check_list/show_ddl_locks.sh @@ -3,13 +3,13 @@ function show_ddl_locks_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "show-ddl-locks a b" \ - "show-ddl-locks \[-w worker ...\] \[task_name\] \[flags\]" 1 + "show-ddl-locks \[-w worker ...\] \[task-name\] \[flags\]" 1 } function show_ddl_locks_while_master_down() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ - "show-ddl-locks task_name -w 127.0.0.1:8262" \ - "can not show DDL locks for task task_name and workers \[127.0.0.1:8262\]" 1 + "show-ddl-locks task-name -w 127.0.0.1:8262" \ + "can not show DDL locks for task task-name and workers \[127.0.0.1:8262\]" 1 } function show_ddl_locks_no_locks() { diff --git a/tests/dmctl_basic/check_list/start_task.sh b/tests/dmctl_basic/check_list/start_task.sh index 90f3ea3754..838bce5756 100644 --- a/tests/dmctl_basic/check_list/start_task.sh +++ b/tests/dmctl_basic/check_list/start_task.sh @@ -3,7 +3,7 @@ function start_task_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "start-task" \ - "start-task \[-w worker ...\] \[flags\]" 1 + "start-task \[-w worker ...\] \[flags\]" 1 } function start_task_wrong_config_file() { diff --git a/tests/dmctl_basic/check_list/stop_task.sh b/tests/dmctl_basic/check_list/stop_task.sh index aa00fa11a0..63545b11b7 100644 --- a/tests/dmctl_basic/check_list/stop_task.sh +++ b/tests/dmctl_basic/check_list/stop_task.sh @@ -3,7 +3,7 @@ function stop_task_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "stop-task" \ - "stop-task \[-w worker ...\] \[flags\]" 1 + "stop-task \[-w worker ...\] \[flags\]" 1 } function stop_task_while_master_down() { diff --git a/tests/dmctl_basic/check_list/update_master_config.sh b/tests/dmctl_basic/check_list/update_master_config.sh index 06ffca2f63..4b91b1b22a 100644 --- a/tests/dmctl_basic/check_list/update_master_config.sh +++ b/tests/dmctl_basic/check_list/update_master_config.sh @@ -3,7 +3,7 @@ function update_master_config_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "update-master-config" \ - "update-master-config \[flags\]" 1 + "update-master-config \[flags\]" 1 } function update_master_config_wrong_config_file() { diff --git a/tests/dmctl_basic/check_list/update_relay.sh b/tests/dmctl_basic/check_list/update_relay.sh index 68c5196fdf..f004dd78fd 100644 --- a/tests/dmctl_basic/check_list/update_relay.sh +++ b/tests/dmctl_basic/check_list/update_relay.sh @@ -3,7 +3,7 @@ function update_relay_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "update-relay" \ - "update-relay \[-w worker ...\] \[flags\]" 1 + "update-relay \[-w worker ...\] \[flags\]" 1 } function update_relay_wrong_config_file() { diff --git a/tests/dmctl_basic/check_list/update_task.sh b/tests/dmctl_basic/check_list/update_task.sh index 031ffd834a..aef8b26fb9 100644 --- a/tests/dmctl_basic/check_list/update_task.sh +++ b/tests/dmctl_basic/check_list/update_task.sh @@ -3,7 +3,7 @@ function update_task_wrong_arg() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "update-task" \ - "update-task \[-w worker ...\] \[flags\]" 1 + "update-task \[-w worker ...\] \[flags\]" 1 } function update_task_wrong_config_file() {