-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes: makefile restored, long quotes, :retab, error fix in util.go…
… while reading files
- Loading branch information
1 parent
99f24d0
commit 8268309
Showing
4 changed files
with
56 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
DESTDIR := | ||
#PREFIX := /usr/local | ||
PREFIX := . | ||
PREFIX := /usr/local | ||
|
||
.PHONY: all | ||
all: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"text": "It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming; but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat.", | ||
"attribution": "Theodore Roosevelt" | ||
}, | ||
{ | ||
"text": "I must not fear. Fear is the mind killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.", | ||
"attribution": "Frank Herbert, Dune" | ||
}, | ||
{ | ||
"text": "The only thing we have to fear is fear itself nameless, unreasoning, unjustified terror which paralyzes needed efforts to convert retreat into advance. In every dark hour of our national life a leadership of frankness and vigor has met with that understanding and support of the people themselves which is essential to victory.", | ||
"attribution": "Franklin D. Roosevelt" | ||
}, | ||
{ | ||
"text": "It is easy in the world to live after the world's opinion; it is easy in solitude to live after our own; but the great man is he who in the midst of the crowd keeps with perfect sweetness the independence of solitude.", | ||
"attribution": "Ralph Waldo Emerson, Self-Reliance" | ||
}, | ||
{ | ||
"text": "The mass of men lead lives of quiet desperation. What is called resignation is confirmed desperation. From the desperate city you go into the desperate country, and have to console yourself with the bravery of minks and muskrats. A stereotyped but unconscious despair is concealed even under what are called the games and amusements of mankind.", | ||
"attribution": "Henry David Thoreau, Walden" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"encoding/json" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
var FILE_STATE_DB string | ||
var MISTAKE_DB string | ||
|
||
func init() { | ||
var ok bool | ||
var data string | ||
var home string | ||
var ok bool | ||
var data string | ||
var home string | ||
|
||
if home, ok = os.LookupEnv("HOME"); !ok { | ||
die("Could not resolve home directory.") | ||
} | ||
if home, ok = os.LookupEnv("HOME"); !ok { | ||
die("Could not resolve home directory.") | ||
} | ||
|
||
if data, ok = os.LookupEnv("XDG_DATA_HOME"); ok { | ||
data = filepath.Join(data, "/tt") | ||
} else { | ||
data = filepath.Join(home, "/.local/share/tt") | ||
} | ||
if data, ok = os.LookupEnv("XDG_DATA_HOME"); ok { | ||
data = filepath.Join(data, "/tt") | ||
} else { | ||
data = filepath.Join(home, "/.local/share/tt") | ||
} | ||
|
||
os.MkdirAll(data, 0700) | ||
os.MkdirAll(data, 0700) | ||
|
||
FILE_STATE_DB = filepath.Join(data, ".db") | ||
MISTAKE_DB = filepath.Join(data, ".errors") | ||
FILE_STATE_DB = filepath.Join(data, ".db") | ||
MISTAKE_DB = filepath.Join(data, ".errors") | ||
} | ||
|
||
func readValue(path string, o interface{}) error { | ||
b, err := ioutil.ReadFile(path) | ||
b, err := ioutil.ReadFile(path) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return json.Unmarshal(b, o) | ||
return json.Unmarshal(b, o) | ||
} | ||
|
||
func writeValue(path string, o interface{}) { | ||
b, err := json.Marshal(o) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
err = ioutil.WriteFile(path, b, 0600) | ||
if err != nil { | ||
panic(err) | ||
} | ||
b, err := json.Marshal(o) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
err = ioutil.WriteFile(path, b, 0600) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters