summaryrefslogtreecommitdiff
path: root/example_test.go
diff options
context:
space:
mode:
authorAndrew Morozko <[email protected]>2019-11-30 00:22:21 +0300
committerAndrew Morozko <[email protected]>2019-11-30 00:22:21 +0300
commitc3a019cdb8116ae3b4a928c2a14efd83df7f34aa (patch)
tree04b6fdab240fb204221af4a500ca170eaf3972fd /example_test.go
parent904e03926794663089b73d52a02def065d819200 (diff)
Various changes
Diffstat (limited to 'example_test.go')
-rw-r--r--example_test.go22
1 files changed, 9 insertions, 13 deletions
diff --git a/example_test.go b/example_test.go
index 3f7f2ab..8f308f1 100644
--- a/example_test.go
+++ b/example_test.go
@@ -135,18 +135,16 @@ func Example_helpText() {
// --help, -h display this help and exit
}
-// This example shows the usage string generated by go-arg with custom datanames
+// This example shows the usage string generated by go-arg with customized placeholders
func Example_helpDataname() {
// These are the args you would pass in on the command line
os.Args = split("./example --help")
var args struct {
- Input string `arg:"positional,dataname:DATAFILE"`
- Output []string `arg:"positional"`
- Verbose bool `arg:"-v" help:"verbosity level"`
- Dataset string `help:"dataset to use"`
- Optimize int `arg:"-O,help:optimization level,dataname:LEVEL"`
- MaxJobs int `arg:"-j,help:maximum number of simultaneous jobs,dataname:N"`
+ Input string `arg:"positional" placeholder:"SRC"`
+ Output []string `arg:"positional" placeholder:"DST"`
+ Optimize int `arg:"-O" help:"optimization level" placeholder:"LEVEL"`
+ MaxJobs int `arg:"-j" help:"maximum number of simultaneous jobs" placeholder:"N"`
}
// This is only necessary when running inside golang's runnable example harness
@@ -156,18 +154,16 @@ func Example_helpDataname() {
// output:
- // Usage: example [--verbose] [--dataset DATASET] [--optimize LEVEL] [--maxjobs N] DATAFILE [OUTPUT [OUTPUT ...]]
+ // Usage: example [--optimize LEVEL] [--maxjobs N] SRC [DST [DST ...]]
// Positional arguments:
- // DATAFILE
- // OUTPUT
+ // SRC
+ // DST
// Options:
- // --verbose, -v verbosity level
- // --dataset DATASET dataset to use
// --optimize LEVEL, -O LEVEL
// optimization level
- // --maxjobs N, -j N maximum number of simultanious jobs
+ // --maxjobs N, -j N maximum number of simultaneous jobs
// --help, -h display this help and exit
}