Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ brew tap satococoa/tap
brew install satococoa/tap/git-worktreeinclude
```

Homebrew installs shell completions for `bash`, `zsh`, and `fish`.

### Build

```sh
Expand Down Expand Up @@ -117,30 +115,6 @@ Prints the recommended `post-checkout` hook snippet.
git-worktreeinclude hook print post-checkout
```

### `git-worktreeinclude completion <bash|zsh|fish|pwsh>`

Outputs a shell completion script generated by the CLI framework.

```sh
git-worktreeinclude completion zsh
```

Examples:

```sh
# bash
source <(git-worktreeinclude completion bash)

# zsh
source <(git-worktreeinclude completion zsh)

# fish
git-worktreeinclude completion fish > ~/.config/fish/completions/git-worktreeinclude.fish

# pwsh
git-worktreeinclude completion pwsh | Out-String | Invoke-Expression
```

## JSON output

`apply --json` emits a single JSON object to stdout.
Expand Down
12 changes: 4 additions & 8 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ func (a *App) Run(args []string) int {

func (a *App) newRootCommand() *ucli.Command {
return &ucli.Command{
Name: "git-worktreeinclude",
Usage: "apply ignored files listed in .worktreeinclude between Git worktrees",
Writer: a.stdout,
ErrWriter: a.stderr,
EnableShellCompletion: true,
ConfigureShellCompletionCommand: func(cmd *ucli.Command) {
cmd.Hidden = false
},
Name: "git-worktreeinclude",
Usage: "apply ignored files listed in .worktreeinclude between Git worktrees",
Writer: a.stdout,
ErrWriter: a.stderr,
OnUsageError: a.onUsageError,
ExitErrHandler: a.handleExitError,
Commands: []*ucli.Command{
Expand Down
13 changes: 0 additions & 13 deletions internal/cli/cli_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,19 +430,6 @@ func TestUsageErrorWritesHelpToStderr(t *testing.T) {
}
}

func TestCompletionCommand(t *testing.T) {
tmpDir := t.TempDir()
for _, shell := range []string{"bash", "zsh", "fish", "pwsh"} {
stdout, stderr, code := runCmd(t, tmpDir, nil, testBinary, "completion", shell)
if code != 0 {
t.Fatalf("completion %s exit code=%d stderr=%s", shell, code, stderr)
}
if strings.TrimSpace(stdout) == "" {
t.Fatalf("completion %s should not be empty", shell)
}
}
}

func TestHookPrintUsageErrorShowsHelpOnStderr(t *testing.T) {
fx := setupFixture(t)

Expand Down