From 564c188b3f7102a3fd3648ddb799c3bfe43ebd86 Mon Sep 17 00:00:00 2001 From: Illyoung Choi Date: Mon, 13 Mar 2023 12:15:07 -0700 Subject: [PATCH] Update help message --- cmd/subcmd/bput.go | 12 ++++++------ cmd/subcmd/cp.go | 4 ++-- cmd/subcmd/get.go | 8 ++++---- cmd/subcmd/put.go | 10 +++++----- cmd/subcmd/sync.go | 8 ++++---- commons/commands.go | 8 ++++---- commons/constant.go | 7 ++++--- 7 files changed, 29 insertions(+), 28 deletions(-) diff --git a/cmd/subcmd/bput.go b/cmd/subcmd/bput.go index ad2b066..2df73d4 100644 --- a/cmd/subcmd/bput.go +++ b/cmd/subcmd/bput.go @@ -28,17 +28,17 @@ func AddBputCommand(rootCmd *cobra.Command) { bputCmd.Flags().MarkHidden("force") bputCmd.Flags().Bool("clear_leftover", false, "Clear leftover bundle files") bputCmd.Flags().Int("max_file_num", commons.MaxBundleFileNumDefault, "Specify max file number in a bundle file") - bputCmd.Flags().String("max_file_size", strconv.FormatInt(commons.MaxBundleFileSizeDefault, 10), "Specify max file size of a bundle file (default is 2GB)") - bputCmd.Flags().Int("upload_thread_num", commons.UploadTreadNumDefault, "Specify the number of upload threads (default is 5)") - bputCmd.Flags().String("tcp_buffer_size", strconv.Itoa(commons.TcpBufferSizeDefault), "Specify TCP socket buffer size (default is 4MB)") + bputCmd.Flags().String("max_file_size", strconv.FormatInt(commons.MaxBundleFileSizeDefault, 10), "Specify max file size of a bundle file") + bputCmd.Flags().Int("upload_thread_num", commons.UploadTreadNumDefault, "Specify the number of upload threads") + bputCmd.Flags().String("tcp_buffer_size", commons.TcpBufferSizeStringDefault, "Specify TCP socket buffer size") bputCmd.Flags().Bool("progress", false, "Display progress bars") bputCmd.Flags().String("local_temp", os.TempDir(), "Specify local temp directory path to create bundle files") bputCmd.Flags().String("irods_temp", "", "Specify iRODS temp directory path to upload bundle files to") bputCmd.Flags().Bool("diff", false, "Put files having different content") bputCmd.Flags().Bool("no_hash", false, "Compare files without using md5 hash") - bputCmd.Flags().Bool("no_replication", false, "Disable replication (default is False)") - bputCmd.Flags().Int("retry", 1, "Retry if fails (default is 1)") - bputCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds (default is 60)") + bputCmd.Flags().Bool("no_replication", false, "Disable replication") + bputCmd.Flags().Int("retry", 1, "Retry if fails") + bputCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds") rootCmd.AddCommand(bputCmd) } diff --git a/cmd/subcmd/cp.go b/cmd/subcmd/cp.go index 4ffcaa1..d22c5e2 100644 --- a/cmd/subcmd/cp.go +++ b/cmd/subcmd/cp.go @@ -29,8 +29,8 @@ func AddCpCommand(rootCmd *cobra.Command) { cpCmd.Flags().Bool("progress", false, "Display progress bars") cpCmd.Flags().Bool("diff", false, "Copy files having different content") cpCmd.Flags().Bool("no_hash", false, "Compare files without using md5 hash") - cpCmd.Flags().Int("retry", 1, "Retry if fails (default is 1)") - cpCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds (default is 60)") + cpCmd.Flags().Int("retry", 1, "Retry if fails") + cpCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds") rootCmd.AddCommand(cpCmd) } diff --git a/cmd/subcmd/get.go b/cmd/subcmd/get.go index 9e667db..f5f6fab 100644 --- a/cmd/subcmd/get.go +++ b/cmd/subcmd/get.go @@ -27,13 +27,13 @@ func AddGetCommand(rootCmd *cobra.Command) { commons.SetCommonFlags(getCmd) getCmd.Flags().BoolP("force", "f", false, "Get forcefully") - getCmd.Flags().Int("download_thread_num", commons.MaxParallelJobThreadNumDefault, "Specify the number of download threads (default is 5)") - getCmd.Flags().String("tcp_buffer_size", strconv.Itoa(commons.TcpBufferSizeDefault), "Specify TCP socket buffer size (default is 4MB)") + getCmd.Flags().Int("download_thread_num", commons.MaxParallelJobThreadNumDefault, "Specify the number of download threads") + getCmd.Flags().String("tcp_buffer_size", commons.TcpBufferSizeStringDefault, "Specify TCP socket buffer size") getCmd.Flags().Bool("progress", false, "Display progress bar") getCmd.Flags().Bool("diff", false, "Get files having different content") getCmd.Flags().Bool("no_hash", false, "Compare files without using md5 hash") - getCmd.Flags().Int("retry", 1, "Retry if fails (default is 1)") - getCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds (default is 60)") + getCmd.Flags().Int("retry", 1, "Retry if fails") + getCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds") rootCmd.AddCommand(getCmd) } diff --git a/cmd/subcmd/put.go b/cmd/subcmd/put.go index 607c9b1..95a0ce1 100644 --- a/cmd/subcmd/put.go +++ b/cmd/subcmd/put.go @@ -28,14 +28,14 @@ func AddPutCommand(rootCmd *cobra.Command) { commons.SetCommonFlags(putCmd) putCmd.Flags().BoolP("force", "f", false, "Put forcefully") - putCmd.Flags().Int("upload_thread_num", commons.MaxParallelJobThreadNumDefault, "Specify the number of upload threads (default is 5)") - putCmd.Flags().String("tcp_buffer_size", strconv.Itoa(commons.TcpBufferSizeDefault), "Specify TCP socket buffer size (default is 4MB)") + putCmd.Flags().Int("upload_thread_num", commons.MaxParallelJobThreadNumDefault, "Specify the number of upload threads") + putCmd.Flags().String("tcp_buffer_size", commons.TcpBufferSizeStringDefault, "Specify TCP socket buffer size") putCmd.Flags().Bool("progress", false, "Display progress bar") putCmd.Flags().Bool("diff", false, "Put files having different content") putCmd.Flags().Bool("no_hash", false, "Compare files without using md5 hash") - putCmd.Flags().Bool("no_replication", false, "Disable replication (default is False)") - putCmd.Flags().Int("retry", 1, "Retry if fails (default is 1)") - putCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds (default is 60)") + putCmd.Flags().Bool("no_replication", false, "Disable replication") + putCmd.Flags().Int("retry", 1, "Retry if fails") + putCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds") rootCmd.AddCommand(putCmd) } diff --git a/cmd/subcmd/sync.go b/cmd/subcmd/sync.go index da8fd8d..905d27f 100644 --- a/cmd/subcmd/sync.go +++ b/cmd/subcmd/sync.go @@ -33,14 +33,14 @@ func AddSyncCommand(rootCmd *cobra.Command) { syncCmd.Flags().String("max_file_size", strconv.FormatInt(commons.MaxBundleFileSizeDefault, 10), "Specify max file size of a bundle file") syncCmd.Flags().Int("upload_thread_num", commons.UploadTreadNumDefault, "Specify the number of upload threads") syncCmd.Flags().Int("download_thread_num", commons.MaxParallelJobThreadNumDefault, "Specify the number of download threads") - syncCmd.Flags().String("tcp_buffer_size", strconv.Itoa(commons.TcpBufferSizeDefault), "Specify TCP socket buffer size (default is 4MB)") + syncCmd.Flags().String("tcp_buffer_size", commons.TcpBufferSizeStringDefault, "Specify TCP socket buffer size") syncCmd.Flags().Bool("progress", false, "Display progress bar") syncCmd.Flags().String("local_temp", os.TempDir(), "Specify local temp directory path to create bundle files") syncCmd.Flags().String("irods_temp", "", "Specify iRODS temp directory path to upload bundle files to") syncCmd.Flags().Bool("no_hash", false, "Compare files without using md5 hash") - syncCmd.Flags().Bool("no_replication", false, "Disable replication (default is False)") - syncCmd.Flags().Int("retry", 1, "Retry if fails (default is 1)") - syncCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds (default is 60)") + syncCmd.Flags().Bool("no_replication", false, "Disable replication") + syncCmd.Flags().Int("retry", 1, "Retry if fails") + syncCmd.Flags().Int("retry_interval", 60, "Retry interval in seconds") rootCmd.AddCommand(syncCmd) } diff --git a/commons/commands.go b/commons/commands.go index fb53163..f57e326 100644 --- a/commons/commands.go +++ b/commons/commands.go @@ -105,14 +105,14 @@ func SetCWD(cwd string) { } func SetCommonFlags(command *cobra.Command) { - command.Flags().StringP("config", "c", "", "Set config file or dir (default is $HOME/.irods)") + command.Flags().StringP("config", "c", "", "Set config file or dir (default \"$HOME/.irods\")") command.Flags().BoolP("envconfig", "e", false, "Read config from environmental variables") command.Flags().BoolP("version", "v", false, "Print version") command.Flags().BoolP("help", "h", false, "Print help") - command.Flags().BoolP("debug", "d", false, "Enable debug mode (default is False)") - command.Flags().String("log_level", "", "Set log level (default is INFO)") + command.Flags().BoolP("debug", "d", false, "Enable debug mode") + command.Flags().String("log_level", "", "Set log level") command.Flags().Int32P("session", "s", -1, "Set session ID") - command.Flags().StringP("resource", "R", "", "Set resource server (default is empty)") + command.Flags().StringP("resource", "R", "", "Set resource server") command.Flags().StringP("ticket", "T", "", "Set ticket") // this is hidden diff --git a/commons/constant.go b/commons/constant.go index 6cb3f31..c2c8880 100644 --- a/commons/constant.go +++ b/commons/constant.go @@ -1,7 +1,8 @@ package commons const ( - UploadTreadNumDefault int = 5 - UploadTreadNumMax int = 20 - TcpBufferSizeDefault int = 4 * 1024 * 1024 + UploadTreadNumDefault int = 5 + UploadTreadNumMax int = 20 + TcpBufferSizeDefault int = 4 * 1024 * 1024 + TcpBufferSizeStringDefault string = "4MB" )