Add support for loading ids from file
This commit is contained in:
17
main.go
17
main.go
@@ -39,9 +39,26 @@ const (
|
||||
|
||||
func main() {
|
||||
envfile := flag.String("envfile", ".env", "")
|
||||
inputfile := flag.String("if", "", "")
|
||||
flag.Parse()
|
||||
|
||||
args := flag.Args()
|
||||
if *inputfile != "" {
|
||||
filehandle, err := os.Open(*inputfile)
|
||||
if err != nil {
|
||||
Error.Printf("Error opening input file: %v", err)
|
||||
return
|
||||
}
|
||||
defer filehandle.Close()
|
||||
fargs, err := io.ReadAll(filehandle)
|
||||
if err != nil {
|
||||
Error.Printf("Error reading input file: %v", err)
|
||||
return
|
||||
}
|
||||
sargs := strings.Split(string(fargs), "\r\n")
|
||||
args = append(args, sargs...)
|
||||
}
|
||||
|
||||
if len(args) == 0 {
|
||||
Error.Println("No args specified, please pass space delimited list of workshop ids for downloading")
|
||||
return
|
||||
|
Reference in New Issue
Block a user