From 8cbd7b31fca5f3813dcc760fec83c730ba94b98c Mon Sep 17 00:00:00 2001 From: JoYo <> Date: Wed, 5 Jun 2024 01:26:03 -0400 Subject: [PATCH] arg names and help --- banana.go | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/banana.go b/banana.go index 193f92e..08d7386 100644 --- a/banana.go +++ b/banana.go @@ -11,9 +11,9 @@ import ( ) var args struct { - Addon_List_Path string `arg:"positional" default:"addons.list"` - Out string `arg:"-o,--out-dir" default:"downloads" help:"path to download directory"` - Delay int `arg:"-d,--delay" default:"30" help:"seconds between poll with jitter"` + Addon_List_Path string `arg:"-i,--addon-list" help:"path to addon list file"` + Out_Dir string `arg:"-o,--live-dir" help:"path to eso live directory"` + Ttc bool `arg:"-t,--ttc" help:"only update tamriel trade centre db"` } func main() { @@ -21,6 +21,26 @@ func main() { fmt.Println("args", args) } +const ( + CONFIG_TEMPLATE = `https://www.esoui.com/downloads/info7-LibAddonMenu.html +https://www.esoui.com/downloads/info1245-TamrielTradeCentre.html +https://www.esoui.com/downloads/info1146-LibCustomMenu.html +` + ESO_LIVE_PATH_WINDOWS = `Documents\Elder Scrolls Online\live` + ESO_LIVE_PATH_STEAMOS = ".steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/" + TCC_PRICE_TABLE_URI = "https://us.tamrieltradecentre.com/download/PriceTable" + TCC_PRICE_TABLE_NAME = "TamrielTradeCentre" +) + +var ( + ESOUI_PREFIX = regexp.MustCompile(`https://www.esoui.com/downloads/info[0-9]+\-`) + ESOUI_VERSION_HTML = regexp.MustCompile(`Version:\s+[^<]+`) + ESOUI_VERSION_SPLIT = regexp.MustCompile(`Version:\s+`) + ESOUI_DOWNLOAD = regexp.MustCompile(`https://cdn.esoui.com/downloads/file[^"]*`) + LIVE_VERSION = regexp.MustCompile(`##\s+Version:\s+.*`) + LIVE_VERSION_SPLIT = regexp.MustCompile(`##\s+Version:\s+`) +) + func addon_list_read(addon_list_path string) ([]string, error) { file_open, error := os.OpenFile(addon_list_path, os.O_RDONLY, 0644) defer file_open.Close() @@ -34,7 +54,12 @@ func addon_list_read(addon_list_path string) ([]string, error) { for file_scanner.Scan() { line := file_scanner.Text() - if strings.HasPrefix(line, "#") { + switch { + case strings.HasPrefix(line, "#"): + continue + case strings.HasPrefix(line, "//"): + continue + case strings.HasPrefix(line, "-"): continue } @@ -43,21 +68,3 @@ func addon_list_read(addon_list_path string) ([]string, error) { return lines, nil } - -const ( - CONFIG_TEMPLATE = `https://www.esoui.com/downloads/info7-LibAddonMenu.html -https://www.esoui.com/downloads/info1245-TamrielTradeCentre.html -https://www.esoui.com/downloads/info1146-LibCustomMenu.html -` - ESO_LIVE_PATH_WINDOWS = `Documents\Elder Scrolls Online\live` - ESO_LIVE_PATH_STEAMOS = ".steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/" -) - -var ( - ESOUI_PREFIX = regexp.MustCompile(`https://www.esoui.com/downloads/info[0-9]+\-`) - ESOUI_VERSION_HTML = regexp.MustCompile(`Version:\s+[^<]+`) - ESOUI_VERSION_SPLIT = regexp.MustCompile(`Version:\s+`) - ESOUI_DOWNLOAD = regexp.MustCompile(`https://cdn.esoui.com/downloads/file[^"]*`) - LIVE_VERSION = regexp.MustCompile(`##\s+Version:\s+.*`) - LIVE_VERSION_SPLIT = regexp.MustCompile(`##\s+Version:\s+`) -)