File: gopher.go

package info (click to toggle)
golang-github-namsral-flag 1.7.4~alpha%2Bgit20170814.67f268f-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 160 kB
  • sloc: makefile: 3
file content (29 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (2)
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
27
28
29
package main

import (
    "github.com/namsral/flag"
    "fmt"
    )

func main() {
    var (
        config string
        length float64
        age int
        name string
        female bool
    )

    flag.StringVar(&config, "config", "", "help message")
    flag.StringVar(&name, "name", "", "help message")
    flag.IntVar(&age, "age", 0, "help message")
    flag.Float64Var(&length, "length", 0, "help message")
    flag.BoolVar(&female, "female", false, "help message")
    
    flag.Parse()
    
    fmt.Println("length:", length)
    fmt.Println("age:", age)
    fmt.Println("name:", name)
    fmt.Println("female:", female)
}