Skip to content

Commit

Permalink
Merge pull request #34 from aaa707/add_root_command
Browse files Browse the repository at this point in the history
Add root command
  • Loading branch information
motemen committed Sep 23, 2014
2 parents 0d8ab07 + 86b271d commit cf8b7e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var Commands = []cli.Command{
commandList,
commandLook,
commandImport,
commandRoot,
}

var commandGet = cli.Command{
Expand Down Expand Up @@ -71,6 +72,12 @@ var commandImport = cli.Command{
Action: doImport,
}

var commandRoot = cli.Command{
Name: "root",
Usage: "Returns repositories' root",
Action: doRoot,
}

type commandDoc struct {
Parent string
Arguments string
Expand All @@ -81,6 +88,7 @@ var commandDocs = map[string]commandDoc{
"list": {"", "[-p] [-e] [<query>]"},
"look": {"", "<project> | <user>/<project> | <host>/<user>/<project>"},
"import": {"", "< file"},
"root": {"", ""},
}

// Makes template conditionals to generate per-command documents.
Expand Down Expand Up @@ -341,3 +349,7 @@ func doImport(c *cli.Context) {
os.Exit(1)
}
}

func doRoot(c *cli.Context) {
fmt.Println(primaryLocalRepositoryRoot())
}

0 comments on commit cf8b7e6

Please sign in to comment.