shad-go/lectures/01-basics/flag/main.go
2020-02-20 17:40:51 +03:00

20 lines
260 B
Go

package main
import (
"flag"
"fmt"
"strings"
)
var (
n = flag.Bool("n", false, "omit trailing newline")
sep = flag.String("s", " ", "separator")
)
func main() {
flag.Parse()
fmt.Print(strings.Join(flag.Args(), *sep))
if !*n {
fmt.Println()
}
}