summaryrefslogtreecommitdiff
path: root/comitium.go
diff options
context:
space:
mode:
Diffstat (limited to 'comitium.go')
-rw-r--r--comitium.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/comitium.go b/comitium.go
index 8228510..69df77a 100644
--- a/comitium.go
+++ b/comitium.go
@@ -14,6 +14,7 @@ import (
"net/url"
"os"
"path/filepath"
+ "strconv"
"github.com/mitchellh/go-homedir"
"golang.nytpu.com/comitium/localizations"
@@ -68,7 +69,13 @@ func main() {
// make sure it exists so we can start working with files in it
os.MkdirAll(dataPath, os.ModePerm)
- err := core.Init(dataPath, localizer, 0)
+ days, err := getHist()
+ if err != nil {
+ fmt.Fprint(os.Stderr, err)
+ os.Exit(1)
+ }
+
+ err = core.Init(dataPath, localizer, days)
if err != nil {
fmt.Fprintf(os.Stderr, core.TranslateStringLocalizer(
localizer, "%s\n",
@@ -203,6 +210,13 @@ func getLang() *localizations.Localizer {
return localizations.New(lang.String(), supportedLangs[0].String())
}
+func getHist() (days int, err error) {
+ if env := os.Getenv("COMITIUM_HISTORY"); env != "" && *histFlag != 31 {
+ return strconv.Atoi(env)
+ }
+ return *histFlag, nil
+}
+
func usage() {
fmt.Fprintf(os.Stderr, "Usage:\n")
fmt.Fprintf(os.Stderr, " %v <command> [FLAGS] [ARGUMENTS]\n\n", os.Args[0])