diff options
author | knolax <1339802534.kk@gmail.com> | 2017-01-19 13:21:46 +0000 |
---|---|---|
committer | knolax <1339802534.kk@gmail.com> | 2017-01-19 13:21:46 +0000 |
commit | 4d205ba0b81dcf5edb669c2f09e8ab1ce4833ceb (patch) | |
tree | df86671154098f6b7a84b60f2de563fd34325dc8 | |
parent | d894e6902ce7c12cb2ec865b8f215dd4a5fe1aad (diff) |
-rw-r--r-- | letters.go | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -6,6 +6,7 @@ import ( "io/ioutil" "errors" "strconv" + "flag" ) type runedata struct { Field [5][5]bool; @@ -126,8 +127,13 @@ func main () () { var frune rune = '9'; var brune rune = '9'; var cover int = 0; + var debugp *bool; + debugp = flag.Bool("debug",false,"whether or not debug commands are printed"); + flag.Parse(); inpreader := bufio.NewReader(os.Stdin); - fmt.Println("%[0-9] for foreground color, $[0-9] for background color, [ to replace using $9%9 returns the terminal to defaults"); + if *debugp { + fmt.Println("%[0-9] for foreground color, $[0-9] for background color, [ to replace using $9%9 returns the terminal to defaults"); + } var trune rune ; trune , _ ,_ = inpreader.ReadRune() for trune != '\n' { @@ -144,7 +150,9 @@ func main () () { if (inp[i] <= '9') && (inp[i] >= '0') { frune = inp[i]; err = coloradd(frune,brune); - fmt.Println("setting foreground color %c",inp[i]); + if *debugp { + fmt.Println("setting foreground color %c",inp[i]); + } } break; case '$': @@ -152,7 +160,9 @@ func main () () { if (inp[i] <= '9') && (inp[i] >= '0') { brune = inp[i]; err = coloradd(frune,brune); - fmt.Println("setting background color %c",inp[i]); + if *debugp { + fmt.Println("setting background color %c",inp[i]); + } } break; default : @@ -189,6 +199,8 @@ func main () () { fmt.Printf("\n"); i++; } - err = ioutil.WriteFile(string(inp),[]byte(tmpstring),0777); - errc(err); + if *debugp { + err = ioutil.WriteFile(string(inp),[]byte(tmpstring),0777); + errc(err); + } } |