Skip to content

Commit 462fa84

Browse files
committed
Changed json.Marshal to json.MarshalIndent
1 parent fa08330 commit 462fa84

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

main.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ var currentDirectory, _ = os.Getwd()
3232
var dateToday = time.Now().Format("01-02-2006")
3333
var allRepos = map[string]any{}
3434

35-
var repoFlag = flag.Bool("backup-repos", false, "Set this flag to backup your repositories and skip the interactive UI (can be combined with backup-stars)")
36-
var starFlag = flag.Bool("backup-stars", false, "Set this flag to backup your starred repositoriesand skip the interactive UI (can be combined with backup-repos)")
37-
var skipList = flag.Bool("skip-list", false, "Set this flag to skip creating a list of all repositories")
38-
var listOnly = flag.Bool("list-only", false, "Set this flag to only generate a list of all repositories and skip cloning. Should not be used with skip-list")
35+
var repoFlag = flag.Bool("backup-repos", false, "Set this flag to backup your repositories and SKIP the interactive UI (can be combined with backup-stars)")
36+
var starFlag = flag.Bool("backup-stars", false, "Set this flag to backup your starred repositoriesand SKIP the interactive UI (can be combined with backup-repos)")
37+
var skipList = flag.Bool("skip-list", false, "Set this flag to skip creating a list of the specified repositories")
38+
var listOnly = flag.Bool("list-only", false, "Set this flag to only generate a list of the repositories specified and skip cloning. Should not be used with skip-list")
3939

4040
func main() {
4141
godotenv.Load()
@@ -58,7 +58,7 @@ func main() {
5858
if err != nil {
5959
fmt.Printf("Error:\n%v\n", err)
6060
}
61-
repoJsonByte, err := json.Marshal(allRepos)
61+
repoJsonByte, err := json.MarshalIndent(allRepos, "", " ")
6262
if err != nil {
6363
fmt.Printf("Error:\n%v\n", err)
6464
}
@@ -68,7 +68,7 @@ func main() {
6868
if err != nil {
6969
fmt.Printf("Error:\n%v\n", err)
7070
}
71-
repoJsonByte, err := json.Marshal(allRepos)
71+
repoJsonByte, err := json.MarshalIndent(allRepos, "", " ")
7272
if err != nil {
7373
fmt.Printf("Error:\n%v\n", err)
7474
}
@@ -240,6 +240,7 @@ func mainMenu() {
240240
}
241241

242242
func backupMenu() {
243+
flag.Parse()
243244
fmt.Println(`What should this program backup?
244245
1) Your public and private repositories
245246
2) Your starred repositories
@@ -250,8 +251,10 @@ func backupMenu() {
250251
switch backupSelection {
251252
case "1":
252253
backupRepos(!*listOnly)
254+
backupStars(false)
253255
case "2":
254256
backupStars(!*listOnly)
257+
backupRepos(false)
255258
case "3":
256259
backupRepos(!*listOnly)
257260
backupStars(!*listOnly)

0 commit comments

Comments
 (0)