Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Add filter to status command
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Pichard <[email protected]>
  • Loading branch information
Valentin Pichard committed Jan 10, 2019
1 parent 8366e67 commit 1b3a4dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

func init() {
RootCmd.AddCommand(statusCmd)
setLocalFlags()
}

// statusCmd represents the status command
Expand All @@ -26,3 +27,7 @@ var statusCmd = &cobra.Command{
return nil
},
}

func setLocalFlags() {
statusCmd.Flags().StringVarP(&helper.Filter, "filter", "f", "", "Show only applications who match")
}
1 change: 1 addition & 0 deletions helper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ type Configuration struct {

var (
CfgFile Configuration
Filter string
)
5 changes: 5 additions & 0 deletions helper/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"os/exec"
"strings"
"time"

. "github.com/logrusorgru/aurora"
Expand Down Expand Up @@ -116,6 +117,10 @@ func printApplicationGroups() error {

line := 0
for appname, key := range CfgFile.Applications {
if Filter != "" && !strings.Contains(appname, Filter) {
continue
}

ps, err := readPumaStats(key)
if err != nil {
return err
Expand Down

0 comments on commit 1b3a4dc

Please sign in to comment.