Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
andornaut committed Jul 30, 2018
1 parent e57bbbb commit e20cce1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Usage:
Available Commands:
add Add files or directories to a repository
apply Create symbolic links from a repository's files to the root filesystem
git Run a git command in a repository
apply Link a repository's contents to the filesystem
git Run a git command in a repository's directory
help Help about any command
remove Remove files or directories from a repository
repository Manage repositories
Expand Down Expand Up @@ -77,9 +77,6 @@ Available Commands:
Flags:
-h, --help help for repository
Global Flags:
-r, --repository string name of repository
Use "gog repository [command] --help" for more information about a command.
```

Expand All @@ -92,10 +89,21 @@ Usage:
gog add [paths...]
Flags:
-h, --help help for add
-h, --help help for add
-r, --repository string name of repository to add to
```

Global Flags:
-r, --repository string name of repository
`gog apply --help`

```
Link a repository's contents to the filesystem
Usage:
gog apply
Flags:
-h, --help help for apply
-r, --repository string name of repository to apply
```

### Notes
Expand Down
20 changes: 13 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ func Execute() {
var repositoryFlag string

var rootCmd = &cobra.Command{
Use: "gog [command]",
Short: "Link files to Git repositories",
SilenceUsage: true,
Use: "gog [command]",
Short: "Link files to Git repositories",
SilenceUsage: true,
TraverseChildren: true,
}

var addCmd = &cobra.Command{
Expand Down Expand Up @@ -69,7 +70,7 @@ var removeCmd = &cobra.Command{

var applyCmd = &cobra.Command{
Use: "apply",
Short: "Create symbolic links from a repository's files to the root filesystem",
Short: "Link a repository's contents to the filesystem",
Args: cobra.NoArgs,
DisableFlagsInUseLine: true,
RunE: func(c *cobra.Command, args []string) error {
Expand All @@ -82,8 +83,9 @@ var applyCmd = &cobra.Command{
}

var gitCmd = &cobra.Command{
Use: "git [git arguments...]",
Short: "Run a git command in a repository",
Use: "git [git command and arguments...]",
Short: "Run a git command in a repository's directory",
DisableFlagParsing: true,
DisableFlagsInUseLine: true,
DisableSuggestions: true,
RunE: func(c *cobra.Command, args []string) error {
Expand Down Expand Up @@ -132,6 +134,10 @@ func repoPath() (string, error) {
}

func init() {
rootCmd.PersistentFlags().StringVarP(&repositoryFlag, "repository", "r", "", "name of repository")
// Cannot add --repository as a persistent flag, because this breaks passthrough to `git`
addCmd.Flags().StringVarP(&repositoryFlag, "repository", "r", "", "name of repository to add to")
applyCmd.Flags().StringVarP(&repositoryFlag, "repository", "r", "", "name of repository to apply")
removeCmd.Flags().StringVarP(&repositoryFlag, "repository", "r", "", "name of repository to remove from")
rootCmd.Flags().StringVarP(&repositoryFlag, "repository", "r", "", "name of repository")
rootCmd.AddCommand(addCmd, applyCmd, gitCmd, removeCmd, repositoryCmd)
}

0 comments on commit e20cce1

Please sign in to comment.