Created
November 19, 2009 02:39
-
-
Save hiroyukim/238494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( 08 "os"; 09 "flag"; // command line option parser 10 ) | |
var omitNewline = flag.Bool("n", false, "don't print final newline") | |
const ( 15 Space = " "; 16 Newline = "\n"; 17 ) | |
func main() { | |
flag.Parse(); | |
var s string = ""; | |
for i := 0; i < flag.NArg(); i++ { | |
if i > 0 { | |
s += Space | |
} | |
s += flag.Arg(i); | |
} | |
if !*omitNewline { | |
s += Newline | |
} | |
os.Stdout.WriteString(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment