From a69ea1dffd2686b7c2b2affc760943b903cbeb81 Mon Sep 17 00:00:00 2001 From: itosho Date: Sun, 13 May 2018 00:13:40 +0900 Subject: [PATCH 1/2] add direcoty --- kadai3/itosho/gownload/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 kadai3/itosho/gownload/.gitkeep diff --git a/kadai3/itosho/gownload/.gitkeep b/kadai3/itosho/gownload/.gitkeep new file mode 100644 index 0000000..e69de29 From 3b81ee9086be5a6cd149fcc200858f57d3240d5d Mon Sep 17 00:00:00 2001 From: itosho Date: Sun, 13 May 2018 00:21:33 +0900 Subject: [PATCH 2/2] add url args --- kadai3/itosho/gownload/main.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 kadai3/itosho/gownload/main.go diff --git a/kadai3/itosho/gownload/main.go b/kadai3/itosho/gownload/main.go new file mode 100644 index 0000000..fa88d96 --- /dev/null +++ b/kadai3/itosho/gownload/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "flag" + "fmt" + "log" + "os" +) + +func main() { + flag.Usage = usage + flag.Parse() + + if flag.NArg() != 1 { + log.Fatal("Invalid Args. Please specify url.") + } + args := flag.Args() + url := args[0] + + print(url) +} + +func usage() { + fmt.Println("usage: gownload [url]") + flag.PrintDefaults() + os.Exit(0) +}