diff options
| -rw-r--r-- | argv.go | 14 | ||||
| -rw-r--r-- | main.go | 19 |
2 files changed, 23 insertions, 10 deletions
@@ -50,7 +50,6 @@ type ShowCmd struct { Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"` Repo *RepoCmd `arg:"subcommand:repos" help:"print a table of the current repos"` Tag *TagCmd `arg:"subcommand:tag" help:"show git tags"` - Urls *EmptyCmd `arg:"subcommand:urls" help:"show repo urls"` } func (ShowCmd) Examples() string { @@ -58,12 +57,13 @@ func (ShowCmd) Examples() string { } type RepoCmd struct { - All bool `arg:"--all" help:"select every repo (the default)"` - Mine bool `arg:"--mine" help:"your repos as defined in the forge config"` - Favorites bool `arg:"--favorites" help:"your repos configured as favorites"` - Private bool `arg:"--private" help:"your private repos from your .config/forge/"` - User bool `arg:"--user" help:"show repos on the user branch"` - Full bool `arg:"--full" help:"show full repo names"` + Urls *EmptyCmd `arg:"subcommand:urls" help:"show repo urls"` + All bool `arg:"--all" help:"select every repo (the default)"` + Mine bool `arg:"--mine" help:"your repos as defined in the forge config"` + Favorites bool `arg:"--favorites" help:"your repos configured as favorites"` + Private bool `arg:"--private" help:"your private repos from your .config/forge/"` + User bool `arg:"--user" help:"show repos on the user branch"` + Full bool `arg:"--full" help:"show full repo names"` // ReadOnly bool `arg:"--readonly" help:"include read-only repos"` } @@ -163,11 +163,11 @@ func main() { okExit("") } - if argv.Show.Urls != nil { - me.forge.PrintForgedTable(me.forge.Repos) + found := findRepos() + if showUrls() { + me.forge.PrintForgedTable(found) okExit("") } - found := findRepos() // print out the repos if argv.All { me.forge.PrintHumanTableFull(found) @@ -206,3 +206,16 @@ func main() { } okExit("") } + +func showUrls() bool { + if argv.Show == nil { + return false + } + if argv.Show.Repo == nil { + return false + } + if argv.Show.Repo.Urls != nil { + return true + } + return false +} |
