From 30d1c4f65e052ddb9cd11b25e751a6e0eb32fdb8 Mon Sep 17 00:00:00 2001 From: nanjiangshu Date: Thu, 16 Jan 2025 00:12:26 +0100 Subject: [PATCH] only show flags with single dash --- download/download.go | 42 +++++++++++++++++++++--------------------- htsget/htsget.go | 4 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/download/download.go b/download/download.go index abc4671..465696c 100644 --- a/download/download.go +++ b/download/download.go @@ -35,24 +35,24 @@ datasets being downloaded. Important: Provide exactly one of the following options to specify files to download: - [filepath(s) or fileid(s)] - - --dataset - - --recursive - - --from-file + - -dataset + - -recursive + - -from-file Global options: -config CONFIGFILE Path to the configuration file. Required options: - -dataset-id Dataset ID for the file(s) to download. - -url The url of the download server. + -dataset-id Dataset ID for the file(s) to download. + -url The url of the download server. Optional options: - --pubkey Encrypt downloaded files server-side using the specified public key. - -outdir Directory to save the downloaded files. - If not specified, files will be saved in the current directory. - --dataset Download all files in the dataset specified by '-dataset-id'. - --recursive Download all files recursively from the given directory path. - --from-file Download all files listed in the specified file. + -pubkey Encrypt downloaded files server-side using the specified public key. + -outdir Directory to save the downloaded files. + If not specified, files will be saved in the current directory. + -dataset Download all files in the dataset specified by '-dataset-id'. + -recursive Download all files recursively from the given directory path. + -from-file Download all files listed in the specified file. Arguments: [filepath(s)] Specific file paths to download. @@ -109,12 +109,12 @@ func Download(args []string, configPath string) error { return fmt.Errorf("missing required arguments, dataset, config and url are required") } - // Check if both --recursive and --dataset flags are set + // Check if both -recursive and -dataset flags are set if *recursiveDownload && *datasetdownload { - return fmt.Errorf("both --recursive and --dataset flags are set, choose one of them") + return fmt.Errorf("both -recursive and -dataset flags are set, choose one of them") } - // Check that file(s) are not missing if the --dataset flag is not set + // Check that file(s) are not missing if the -dataset flag is not set if len(Args.Args()) == 0 && !*datasetdownload { if !*recursiveDownload { return fmt.Errorf("no files provided for download") @@ -123,17 +123,17 @@ func Download(args []string, configPath string) error { return fmt.Errorf("no folders provided for recursive download") } - // Check if --dataset flag is set and files are provided + // Check if -dataset flag is set and files are provided if *datasetdownload && len(Args.Args()) > 0 { return fmt.Errorf( - "files provided with --dataset flag, add either the flag or the file(s), not both", + "files provided with -dataset flag, add either the flag or the file(s), not both", ) } - // Check if --from-file flag is set and only one file is provided + // Check if -from-file flag is set and only one file is provided if *fromFile && len(Args.Args()) != 1 { return fmt.Errorf( - "one file should be provided with --from-file flag", + "one file should be provided with -from-file flag", ) } @@ -150,11 +150,11 @@ func Download(args []string, configPath string) error { } switch { - // Case where the user is setting the --dataset flag + // Case where the user is setting the -dataset flag // then download all the files in the dataset. - // Case where the user is setting the --recursive flag + // Case where the user is setting the -recursive flag // then download the content of the path - // Case where the user is setting the --from-file flag + // Case where the user is setting the -from-file flag // then download the files from the file list // Default case, download the provided files. case *datasetdownload: diff --git a/htsget/htsget.go b/htsget/htsget.go index ed87dcd..4a56def 100644 --- a/htsget/htsget.go +++ b/htsget/htsget.go @@ -38,7 +38,7 @@ Optional options: -output Output name for the downloaded file. If not specified, the file will be downloaded to the current directory as the original filename. - --force-overwrite Overwrite existing files without prompting.` + -force-overwrite Overwrite existing files without prompting.` // Args is a flagset that needs to be exported so that it can be written to the // main program help @@ -169,7 +169,7 @@ func downloadFiles(htsgeURLs htsgetResponse, config *helpers.Config) (err error) } if helpers.FileExists(filenameToUse) && !*forceOverwrite { - return fmt.Errorf("local file already exists, use --force-overwrite to overwrite") + return fmt.Errorf("local file already exists, use -force-overwrite to overwrite") } out, err := os.OpenFile(filenameToUse, os.O_CREATE|os.O_WRONLY, 0644) if err != nil {