diff --git a/main.go b/main.go index c4a8950..8e91f11 100644 --- a/main.go +++ b/main.go @@ -21,10 +21,18 @@ func main() { Error(err) // Get name of file to be processed. - pterm.Printf(pterm.Cyan("What is the name of the file in this directory?: ")) - reader := bufio.NewReader(os.Stdin) - input, err := reader.ReadString('\n') - Error(err) + args := os.Args[1:] + + var input string + + if len(args) > 0 { + input = args[0] + } else { + pterm.Printf(pterm.Cyan("What is the name of the file in this directory?: ")) + reader := bufio.NewReader(os.Stdin) + input, err = reader.ReadString('\n') + Error(err) + } // Create upcs array and push all upc strings into it input = strings.TrimSpace(input)