From 56befb69f10e888c4152274127295feedb7ed16c Mon Sep 17 00:00:00 2001 From: hahwul Date: Tue, 9 Feb 2021 02:47:23 +0900 Subject: [PATCH] (Closed #4) Added append --- main.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 67e5671..9820937 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "strings" app "github.com/hahwul/gee/pkg/gee" model "github.com/hahwul/gee/pkg/model" @@ -11,16 +12,31 @@ import ( func main() { // Commandline parse - version := flag.Bool("-version", false, "version of gee") + versionOption := flag.Bool("version", false, "Version of gee") + appendOption := flag.Bool("append", false, "Append mode for files") flag.Parse() - options := model.Options{ - Files: flag.Args(), - } // Show version - if *version { + if *versionOption { fmt.Println(printing.VERSION) + return + } + + // Finding file value + var files []string + args := flag.Args() + for _, v := range args { + if !strings.Contains(v, "-") { + files = append(files, v) + } } + + // Set Options + options := model.Options{ + Files: files, + Append: *appendOption, + } + // Running gee app app.Gee(options) }