Skip to content

Commit

Permalink
Fix index out of range with os.Args
Browse files Browse the repository at this point in the history
  • Loading branch information
IRHM committed Aug 2, 2020
1 parent b552f1d commit 900d6e8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ import (

func main() {
var nogit bool = false
if os.Args[1] == "nogit" {
nogit = true
fmt.Println("Ok, won't backup to git. Will still move exported files to GitRepoFolder.")

// Check if any args have been set
if len(os.Args) > 1 {
if os.Args[1] == "nogit" {
nogit = true
fmt.Println("Ok, won't backup to git. Will still move exported files to GitRepoFolder.")
} else {
fmt.Println("The only supported arg is 'nogit'")
os.Exit(1)
}
}

// Get settings from settings.json
Expand Down

0 comments on commit 900d6e8

Please sign in to comment.