Skip to content

Commit

Permalink
Fix Platform.sh command helps (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 31, 2022
1 parent a91ace7 commit a96b6a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions commands/platformsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,20 @@ func (p *platformshCLI) RunInteractive(logger zerolog.Logger, projectDir string,
}
return buf, true
}

func (p *platformshCLI) WrapHelpPrinter() func(w io.Writer, templ string, data interface{}) {
currentHelpPrinter := console.HelpPrinter
return func(w io.Writer, templ string, data interface{}) {
switch cmd := data.(type) {
case *console.Command:
if strings.HasPrefix(cmd.Category, "cloud") {
e := p.executor([]string{strings.TrimPrefix(cmd.FullName(), "cloud:"), "--help", "--ansi"})
e.Execute(false)
} else {
currentHelpPrinter(w, templ, data)
}
default:
currentHelpPrinter(w, templ, data)
}
}
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func main() {
os.Exit(1)
}
cmds = append(cmds, psh.Commands...)
console.HelpPrinter = psh.WrapHelpPrinter()
app := &console.Application{
Name: "Symfony CLI",
Usage: "Symfony CLI helps developers manage projects, from local code to remote infrastructure",
Expand Down

0 comments on commit a96b6a9

Please sign in to comment.