github.com/x-motemen/ghq@v1.6.1/cmd_root.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/urfave/cli/v2"
     7  )
     8  
     9  func doRoot(c *cli.Context) error {
    10  	roots, err := localRepositoryRoots(true)
    11  	if err != nil {
    12  		return err
    13  	}
    14  	if !c.Bool("all") {
    15  		roots = roots[:1] // only the first root is needed
    16  	}
    17  
    18  	for _, root := range roots {
    19  		_, err := fmt.Fprintln(c.App.Writer, root)
    20  		if err != nil {
    21  			return err
    22  		}
    23  	}
    24  
    25  	return nil
    26  }