File: calculator_example.go

package info (click to toggle)
golang-github-docopt-docopt-go 0.6.2%2Bgit20160216.0.784ddc5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 220 kB
  • ctags: 180
  • sloc: makefile: 11
file content (26 lines) | stat: -rw-r--r-- 548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
	"fmt"
	"github.com/docopt/docopt-go"
)

func main() {
	usage := `Not a serious example.

Usage:
  calculator_example <value> ( ( + | - | * | / ) <value> )...
  calculator_example <function> <value> [( , <value> )]...
  calculator_example (-h | --help)

Examples:
  calculator_example 1 + 2 + 3 + 4 + 5
  calculator_example 1 + 2 '*' 3 / 4 - 5    # note quotes around '*'
  calculator_example sum 10 , 20 , 30 , 40

Options:
  -h, --help
`
	arguments, _ := docopt.Parse(usage, nil, true, "", false)
	fmt.Println(arguments)
}