Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing bosh completion code #648

Merged
merged 1 commit into from
May 6, 2024
Merged
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
31 changes: 20 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"fmt"
"github.com/cloudfoundry/bosh-cli/v7/cmd/completion"

Check failure on line 5 in main.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

File is not `goimports`-ed (goimports)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should move down around like 16 / 17

"os"
"os/signal"
"runtime/debug"
Expand All @@ -24,19 +25,27 @@

ui := boshui.NewConfUI(logger)
defer ui.Flush()
if completion.IsItCompletionCommand(os.Args[1:]) {
// completion support
blindUi := boshui.NewWrappingConfUI(&completion.BlindUI{}, logger) // only completion can write to stdout
bc := completion.NewBoshComplete(blindUi, logger)
if _, err := bc.Execute(os.Args[1:]); err != nil {
fail(err, ui, logger)
}
} else {
cmdFactory := boshcmd.NewFactory(boshcmd.NewBasicDeps(ui, logger))

cmdFactory := boshcmd.NewFactory(boshcmd.NewBasicDeps(ui, logger))

cmd, err := cmdFactory.New(os.Args[1:])
if err != nil {
fail(err, ui, logger)
}
cmd, err := cmdFactory.New(os.Args[1:])
if err != nil {
fail(err, ui, logger)
}

err = cmd.Execute()
if err != nil {
fail(err, ui, logger)
} else {
success(ui, logger)
err = cmd.Execute()
if err != nil {
fail(err, ui, logger)
} else {
success(ui, logger)
}
}
}

Expand Down
Loading