mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 15:36:19 -04:00
31 lines
429 B
Go
31 lines
429 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func doRoot(c *cli.Context) error {
|
|
var (
|
|
w = c.App.Writer
|
|
all = c.Bool("all")
|
|
)
|
|
if all {
|
|
roots, err := localRepositoryRoots(true)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
for _, root := range roots {
|
|
fmt.Fprintln(w, root)
|
|
}
|
|
return nil
|
|
}
|
|
root, err := primaryLocalRepositoryRoot()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fmt.Fprintln(w, root)
|
|
return nil
|
|
}
|