summaryrefslogtreecommitdiff
path: root/files.go
diff options
context:
space:
mode:
Diffstat (limited to 'files.go')
-rw-r--r--files.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/files.go b/files.go
index 052c4fb..4964750 100644
--- a/files.go
+++ b/files.go
@@ -11,17 +11,19 @@ import (
"path/filepath"
"strings"
"syscall"
+ "time"
"github.com/BurntSushi/toml"
)
type ConfigMain struct {
- DefaultScheme string `toml:"default_scheme"`
- SoftWrap int `toml:"soft_wrap"`
- DownloadFolder string `toml:"download_folder"`
- VimKeys bool `toml:"vim_keys"`
- Quiet bool `toml:"quiet"`
- Pager string `toml:"pager"`
+ DefaultScheme string `toml:"default_scheme"`
+ SoftWrap int `toml:"soft_wrap"`
+ DownloadFolder string `toml:"download_folder"`
+ VimKeys bool `toml:"vim_keys"`
+ Quiet bool `toml:"quiet"`
+ Pager string `toml:"pager"`
+ Timeout duration `toml:"duration"`
}
type Config struct {
@@ -30,6 +32,14 @@ type Config struct {
Handlers map[string]string `toml:"handlers"`
}
+type duration struct{ time.Duration }
+
+func (d *duration) UnmarshalText(text []byte) error {
+ var err error
+ d.Duration, err = time.ParseDuration(string(text))
+ return err
+}
+
func getConfig() (*Config, error) {
home := os.Getenv("HOME")
path := os.Getenv("XDG_CONFIG_HOME")
@@ -50,6 +60,9 @@ func getConfig() (*Config, error) {
DownloadFolder: home,
Quiet: false,
Pager: "auto",
+ Timeout: duration{
+ time.Duration(10 * time.Second),
+ },
},
Handlers: map[string]string{},
}