summaryrefslogtreecommitdiff
path: root/letters.go
diff options
context:
space:
mode:
Diffstat (limited to 'letters.go')
-rw-r--r--letters.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/letters.go b/letters.go
index 868fac1..cc0a154 100644
--- a/letters.go
+++ b/letters.go
@@ -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);
+ }
}