implemented sub subcommand

implemented the sub subcommand and did some clean up for the function
This commit is contained in:
dm
2016-03-11 21:50:32 -08:00
parent 60d320088d
commit ca2c861387
2 changed files with 17 additions and 16 deletions
+3 -5
View File
@@ -2,7 +2,6 @@ package psyfer
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
)
@@ -13,13 +12,13 @@ type KeyJSON struct {
var k = KeyJSON{}
func ReadConfig() {
dat, err := ioutil.ReadFile("key.json")
func ReadConfig(file string) {
dat, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
json.Unmarshal([]byte(dat), &k)
fmt.Println(k.Key["a"])
k.Key[" "] = " " // keep spaces alive
}
func Substitution(input string) string {
@@ -31,6 +30,5 @@ func Substitution(input string) string {
for i := range inputSlice {
output += k.Key[inputSlice[i]]
}
fmt.Println(output)
return output
}