mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-17 04:21:00 +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:
12
config.go
12
config.go
@@ -23,21 +23,23 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION string = "0.0.5"
|
||||
VERSION string = "0.0.6"
|
||||
Baseuri string = "https://www.kleinanzeigen.de"
|
||||
Listuri string = "/s-bestandsliste.html"
|
||||
Defaultdir string = "."
|
||||
DefaultTemplate string = "Title: {{.Title}}\nPrice: {{.Price}}\nId: {{.Id}}\n" +
|
||||
"Category: {{.Category}}\nCondition: {{.Condition}}\nCreated: {{.Created}}\n\n{{.Text}}\n"
|
||||
DefaultTemplateWin string = "Title: {{.Title}}\r\nPrice: {{.Price}}\r\nId: {{.Id}}\r\n" +
|
||||
"Category: {{.Category}}\r\nCondition: {{.Condition}}\r\nCreated: {{.Created}}\r\n\r\n{{.Text}}\r\n"
|
||||
Useragent string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Verbose bool `hcl:"verbose"`
|
||||
User int `hcl:"user"`
|
||||
Outdir string `hcl:"outdir"`
|
||||
Template string `hcl:"template"`
|
||||
Verbose *bool `hcl:"verbose"`
|
||||
User *int `hcl:"user"`
|
||||
Outdir *string `hcl:"outdir"`
|
||||
Template *string `hcl:"template"`
|
||||
}
|
||||
|
||||
func ParseConfigfile(file string) (*Config, error) {
|
||||
|
||||
Reference in New Issue
Block a user