Skip to content

Commit

Permalink
remove ArgHelp
Browse files Browse the repository at this point in the history
  • Loading branch information
nanjiangshu committed Jan 13, 2025
1 parent 4062598 commit ac8ee28
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 73 deletions.
9 changes: 2 additions & 7 deletions create_key/create_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// Usage text that will be displayed when the `help createKey` command is invoked.
var Usage = `
Usage: %s createKey [OPTIONS] NAME
Usage: %s createKey [OPTIONS] <name>
Generate a Crypt4GH encryption key pair and saves the keys as:
- <name>.pub.pem (public key)
Expand All @@ -31,12 +31,7 @@ Options:
If not specified, the current directory is used.
Arguments:
NAME The basename of the keyfiles to generate.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help.
var ArgHelp = ""
<name> The basename of the keyfiles to generate.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
9 changes: 1 addition & 8 deletions decrypt/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ Optional options:
Arguments:
[file(s)] One or more files to decrypt. All flagless arguments are
treated as filenames for decryption.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = `
[file(s)]
All flagless arguments will be used as filenames for decryption.`
treated as filenames for decryption.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
7 changes: 1 addition & 6 deletions download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ Optional options:
Arguments:
[filepath(s)] Specific file paths to download.
[fileid(s)] File IDs of files to download.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = ""
[fileid(s)] File IDs of files to download.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
8 changes: 2 additions & 6 deletions encrypt/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ Options:
-continue=true|false Skip files with errors and continue processing others. Defaults to 'false'.
Arguments:
[file(s)] List of file paths to be encrypted. All flagless arguments are treated as filenames.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = ""
[file(s)] List of file paths to be encrypted.
All flagless arguments are treated as filenames.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
7 changes: 1 addition & 6 deletions htsget/htsget.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ Optional options:
-output <file> 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.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = ""
--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
Expand Down
7 changes: 1 addition & 6 deletions list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ Options:
-url <uri> Specify the SDA download server URL when using '-datasets' or '-dataset'.
Arguments:
[prefix] Optional prefix to filter results to a specific location or folder path.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = ""
[prefix] Optional prefix to filter results to a specific location or folder path.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
7 changes: 1 addition & 6 deletions login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ Authenticates the user with the Sensitive Data Archive (SDA) using the specified
Arguments:
<login-target> The base URL of the service to log in to. This is required
and determines the SDA service to authenticate against.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = ""
and determines the SDA service to authenticate against.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
22 changes: 9 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,18 @@ Run '%s help <command>' for more information on a command.
type commandInfo struct {
args *flag.FlagSet
usage string
argHelp string
}

var Commands = map[string]commandInfo{
"encrypt": {encrypt.Args, encrypt.Usage, encrypt.ArgHelp},
"createKey": {createKey.Args, createKey.Usage, createKey.ArgHelp},
"decrypt": {decrypt.Args, decrypt.Usage, decrypt.ArgHelp},
"upload": {upload.Args, upload.Usage, upload.ArgHelp},
"list": {list.Args, list.Usage, list.ArgHelp},
"htsget": {htsget.Args, htsget.Usage, htsget.ArgHelp},
"login": {login.Args, login.Usage, login.ArgHelp},
"download": {download.Args, download.Usage, download.ArgHelp},
"version": {version.Args, version.Usage, version.ArgHelp},
"encrypt": {encrypt.Args, encrypt.Usage},
"createKey": {createKey.Args, createKey.Usage},
"decrypt": {decrypt.Args, decrypt.Usage},
"upload": {upload.Args, upload.Usage},
"list": {list.Args, list.Usage},
"htsget": {htsget.Args, htsget.Usage},
"login": {login.Args, login.Usage},
"download": {download.Args, download.Usage},
"version": {version.Args, version.Usage},
}

// Main does argument parsing, then delegates to one of the sub modules
Expand Down Expand Up @@ -197,9 +196,6 @@ func Help(command string) error {

// Print subcommand help
fmt.Printf(info.usage+"\n", ExecName)
// fmt.Println("Command line arguments:")
// info.args.PrintDefaults()
// fmt.Println(info.argHelp)

return nil
}
7 changes: 1 addition & 6 deletions upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ Options:
Arguments:
[file(s) | folder(s)] List of files or directories to upload. Directories are
skipped unless the '-r' flag is provided.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = ""
skipped unless the '-r' flag is provided.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down
11 changes: 2 additions & 9 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,9 @@ import (
// Usage text that will be displayed as command line help text when using the
// `help version` command
var Usage = `
USAGE: %s version
Usage: %s version
version:
Returns the version of the sda-cli tool.
`

// ArgHelp is the suffix text that will be displayed after the argument list in
// the module help
var ArgHelp = `
version does not take any arguments`
Show the version of the sda-cli tool.`

// Args is a flagset that needs to be exported so that it can be written to the
// main program help
Expand Down

0 comments on commit ac8ee28

Please sign in to comment.