From f82c6ff724d6e56052c40f409be785b796eca2ab Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Sat, 15 Sep 2018 18:17:31 +0200 Subject: Load new DB with flag fully implemented --- interact.go | 8 +++++--- main.go | 11 ++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/interact.go b/interact.go index 6ed06c6..7514046 100644 --- a/interact.go +++ b/interact.go @@ -31,7 +31,7 @@ func interact() { promptcol := boldBlue // display info. - shell.Println("Starting interactive Shell") + //shell.Println("Starting interactive Shell") shell.SetPrompt(promptcol(">>>")) shell.AddCmd(&ishell.Cmd{ @@ -569,12 +569,14 @@ func interact() { // teardown //shell.Close() // when started with "exit" as first argument, assume non-interact ive execution + args := removeStringFromArray(os.Args[1:],"-file",1) - if len(os.Args) > 1 { - args := removeStringFromArray(os.Args[1:],"-file",1) + if len(args) > 0 { + //args := removeStringFromArray(os.Args[1:],"-file",1) //fmt.Println(args) shell.Process(args...) } else { + shell.Println("Starting interactive Shell") //start shell shell.Run() // teardown diff --git a/main.go b/main.go index bcfe22b..c34a829 100644 --- a/main.go +++ b/main.go @@ -62,7 +62,7 @@ func init() { "Test Some Functions") flag.StringVar(&filename, "file", - "~/.mytimes.db", + "none", "Open a different Database than specified in Configuration") // CUSTOMIZE USAGE flag.Usage = func() { @@ -94,6 +94,10 @@ func main() { // } initConf() dbname = config.Database + + if filename != "none" { + dbname = filename + } /* if len(flag.Args())>0 { aar := flag.Args() @@ -118,8 +122,9 @@ func main() { */ if test { - fmt.Println(getGitTag()) - fmt.Println("Nothing to test") + fmt.Println(Round(12.55,0.5),Round(12.55,0.1),Round(12.55,1),Round(12.55,5)) + //fmt.Println(getGitTag()) + //fmt.Println("Nothing to test") //tmpltest() //newBill(1) //c := []int{2,3} -- cgit v1.2.3