From a562d6acdb7df4b389964b0b2784717a187662d5 Mon Sep 17 00:00:00 2001 From: dtluna Date: Tue, 26 Mar 2019 12:35:50 +0300 Subject: [PATCH] Accept multiple strings as command-line arguments --- yes/yes.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yes/yes.go b/yes/yes.go index 7340d7e..d135c7e 100644 --- a/yes/yes.go +++ b/yes/yes.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "strings" ) func yes(word string) { @@ -15,6 +16,7 @@ func main() { if len(os.Args) == 1 { yes("y") } else { - yes(os.Args[1]) + word := strings.Join(os.Args[1:], " ") + yes(word) } }