Skip to content

Instantly share code, notes, and snippets.

@RyanBreaker
Last active November 23, 2015 06:27
Show Gist options
  • Save RyanBreaker/26e896a04d5cc53d95d6 to your computer and use it in GitHub Desktop.
Save RyanBreaker/26e896a04d5cc53d95d6 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"flag"
)
func main() {
var noNewLine bool
flag.BoolVar(&noNewLine, "n", false, "Do not print the trailing newline character.")
flag.Parse()
for i := len(flag.Args()) - flag.NArg(); i < flag.NArg(); i++ {
fmt.Print(flag.Arg(i))
if i != flag.NArg() - 1 {
fmt.Print(" ")
}
}
if !noNewLine {
fmt.Println()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment