mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-16 20:11:01 +01:00
Dev (#8)
* fixed conf parsing: variables can now be omitted from the config * fix newlines: use CRLF on windows * bump version --------- Co-authored-by: Thomas von Dein <tom@vondein.org>
This commit is contained in:
18
main.go
18
main.go
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/lmittmann/tint"
|
||||
@@ -109,7 +110,7 @@ func Main() int {
|
||||
return Die(err)
|
||||
}
|
||||
|
||||
if enableverbose || conf.Verbose {
|
||||
if enableverbose || *conf.Verbose {
|
||||
logLevel.Set(slog.LevelInfo)
|
||||
}
|
||||
|
||||
@@ -135,8 +136,8 @@ func Main() int {
|
||||
slog.Debug("config", "conf", conf)
|
||||
|
||||
if len(dir) == 0 {
|
||||
if len(conf.Outdir) > 0 {
|
||||
dir = conf.Outdir
|
||||
if len(*conf.Outdir) > 0 {
|
||||
dir = *conf.Outdir
|
||||
} else {
|
||||
dir = Defaultdir
|
||||
}
|
||||
@@ -150,8 +151,11 @@ func Main() int {
|
||||
|
||||
// which template to use
|
||||
template := DefaultTemplate
|
||||
if len(conf.Template) > 0 {
|
||||
template = conf.Template
|
||||
if runtime.GOOS == "windows" {
|
||||
template = DefaultTemplateWin
|
||||
}
|
||||
if len(*conf.Template) > 0 {
|
||||
template = *conf.Template
|
||||
}
|
||||
|
||||
// directly backup ad listing[s]
|
||||
@@ -167,8 +171,8 @@ func Main() int {
|
||||
}
|
||||
|
||||
// backup all ads of the given user (via config or cmdline)
|
||||
if uid == 0 && conf.User > 0 {
|
||||
uid = conf.User
|
||||
if uid == 0 && *conf.User > 0 {
|
||||
uid = *conf.User
|
||||
}
|
||||
|
||||
if uid > 0 {
|
||||
|
||||
Reference in New Issue
Block a user