1
0
mirror of https://github.com/byReqz/go-etcher.git synced 2024-12-25 12:41:49 +00:00

add nonflag argument handling

This commit is contained in:
Nils 2022-01-12 23:35:36 +01:00
parent a7378b14e0
commit 8390130252
Signed by: byreqz
GPG Key ID: 396A62D7D436749E

16
main.go
View File

@ -96,11 +96,23 @@ func main() {
s := spinner.New(spinner.CharSets[14], 100*time.Millisecond)
if input == "" {
input = GetPath()
if len(flag.Args()) == 0 {
input = GetPath()
} else if len(flag.Args()) > 0 {
input = flag.Args()[0]
}
}
if device == "" {
device = GetDest()
if len(flag.Args()) == 0 {
device = GetDest()
} else if len(flag.Args()) > 0 {
if input == flag.Args()[0] && len(flag.Args()) > 1 {
device = flag.Args()[1]
} else if input != flag.Args()[0] && len(flag.Args()) > 0 {
device = flag.Args()[0]
}
}
}
s.Prefix = "[ "