|
9 | 9 | ginclient "github.com/G-Node/gin-cli/ginclient"
|
10 | 10 | "github.com/G-Node/gin-cli/gincmd/ginerrors"
|
11 | 11 | "github.com/G-Node/gin-cli/git"
|
| 12 | + "github.com/fatih/color" |
12 | 13 | "github.com/spf13/cobra"
|
13 | 14 | )
|
14 | 15 |
|
@@ -68,7 +69,34 @@ func lsRepo(cmd *cobra.Command, args []string) {
|
68 | 69 | // print each category with len(items) > 0 with appropriate header
|
69 | 70 | for _, status := range statuses {
|
70 | 71 | fmt.Printf("%s:\n", status.Description())
|
71 |
| - fmt.Printf("\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 72 | + switch d := status; { |
| 73 | + case d == ginclient.Synced: |
| 74 | + fmt.Fprintf(color.Output, green("\n\t%s\n\n"), strings.Join(statFiles[status], "\n\t")) |
| 75 | + case d == ginclient.NoContent: |
| 76 | + fmt.Fprintf(color.Output, " (use \"gin get-content <file>...\" to download content)\n") |
| 77 | + fmt.Fprintf(color.Output, "\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 78 | + case d == ginclient.Modified: |
| 79 | + fmt.Fprintf(color.Output, " (use \"gin upload <file>...\" to upload changes\n") |
| 80 | + fmt.Fprintf(color.Output, " (use \"gin commit <file>...\" to save changes locally)\n") |
| 81 | + fmt.Fprintf(color.Output, yellow("\n\t%s\n\n"), strings.Join(statFiles[status], "\n\t")) |
| 82 | + case d == ginclient.LocalChanges: |
| 83 | + fmt.Fprintf(color.Output, " (use \"gin upload <file>...\" to upload changes)\n") |
| 84 | + fmt.Fprintf(color.Output, "\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 85 | + case d == ginclient.RemoteChanges: |
| 86 | + fmt.Fprintf(color.Output, " (use \"gin download <file>...\" to download changes)\n") |
| 87 | + fmt.Fprintf(color.Output, "\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 88 | + case d == ginclient.Unlocked: |
| 89 | + fmt.Fprintf(color.Output, " (use \"gin lock <file>...\" to lock file)\n") |
| 90 | + fmt.Fprintf(color.Output, "\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 91 | + case d == ginclient.Removed: |
| 92 | + fmt.Fprintf(color.Output, red("\n\t%s\n\n"), strings.Join(statFiles[status], "\n\t")) |
| 93 | + case d == ginclient.Untracked: |
| 94 | + fmt.Fprintf(color.Output, " (use \"gin upload <file>...\" to upload file and begin tracking)\n") |
| 95 | + fmt.Fprintf(color.Output, "\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 96 | + default: |
| 97 | + fmt.Fprintf(color.Output, "\n\t%s\n\n", strings.Join(statFiles[status], "\n\t")) |
| 98 | + } |
| 99 | + |
72 | 100 | }
|
73 | 101 | }
|
74 | 102 | }
|
|
0 commit comments