Skip to content

Commit

Permalink
Merge pull request #159 from Zyko0/cli_fix_#158
Browse files Browse the repository at this point in the history
Fixed completion on restart command #158
  • Loading branch information
Soulou committed Oct 9, 2015
2 parents 7676134 + e7118d9 commit 4dbfc7b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cmd/autocomplete/restart.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package autocomplete

import (
"fmt"

"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/codegangsta-cli"
"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/go-scalingo"
"github.com/Scalingo/cli/Godeps/_workspace/src/gopkg.in/errgo.v1"
)

func RestartAutoComplete(c *cli.Context) error {
appName := CurrentAppCompletion(c)
if appName == "" {
return nil
}

processes, err := scalingo.AppsPs(appName)
if err != nil {
return errgo.Mask(err)
}
for _, ct := range processes {
fmt.Println(ct.Name)
}

return nil
}
1 change: 1 addition & 0 deletions cmd/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "restart")
autocomplete.RestartAutoComplete(c)
},
}
)

0 comments on commit 4dbfc7b

Please sign in to comment.