allowed file to be entered as argument
This commit is contained in:
parent
52714efc92
commit
d38cfc8036
16
main.go
16
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)
|
||||
|
Loading…
Reference in New Issue
Block a user