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() {
|
func main() {
|
||||||
envfile := flag.String("envfile", ".env", "")
|
envfile := flag.String("envfile", ".env", "")
|
||||||
|
inputfile := flag.String("if", "", "")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
args := flag.Args()
|
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 {
|
if len(args) == 0 {
|
||||||
Error.Println("No args specified, please pass space delimited list of workshop ids for downloading")
|
Error.Println("No args specified, please pass space delimited list of workshop ids for downloading")
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user