Skip to content

Commit

Permalink
#69 new flag display subscriptions column - addendum for README.md (#71)
Browse files Browse the repository at this point in the history
* feat (display-subscriptions-column): add the '-u' shorthand for the long option '--display-subscriptions-column' and updated the README.md file accordingly to mention these new options

Co-authored-by: Kyriakos Sidiropoulos <[email protected]>
  • Loading branch information
dsidirop and ksidirop-laerdal authored May 26, 2022
1 parent 94feb2b commit 2fce567
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ _testmain.go
/nats-top

# VSCode

.vscode/**
*.code-workspace
9 changes: 6 additions & 3 deletions nats-top.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
outputDelimiter = flag.String("l", "", "Specifies the delimiter to use for the output file when the '-o' parameter is used. By default this option is unset which means that standard grid-like plain-text output will be used.")
displayRawBytes = flag.Bool("b", false, "Display traffic in raw bytes.")
maxStatsRefreshes = flag.Int("r", -1, "Specifies the maximum number of times nats-top should refresh nats-stats before exiting.")
displaySubscriptionsColumn = flag.Bool("display-subscriptions-column", false, "Display subscriptions column upon launch.")
displaySubscriptionsColumn = false

// Secure options
httpsPort = flag.Int("ms", 0, "The NATS server secure monitoring port.")
Expand All @@ -41,7 +41,7 @@ var (

const usageHelp = `
usage: nats-top [-s server] [-m http_port] [-ms https_port] [-n num_connections] [-d delay_secs] [-r max] [-o FILE] [-l DELIMITER] [-sort by]
[-cert FILE] [-key FILE] [-cacert FILE] [-k] [-b] [-v|--version] [-display-subscriptions-column]
[-cert FILE] [-key FILE] [-cacert FILE] [-k] [-b] [-v|--version] [-u|--display-subscriptions-column]
`

Expand All @@ -53,6 +53,9 @@ func init() {
flag.BoolVar(&showVersion, "v", false, "Same as --version.")
flag.BoolVar(&showVersion, "version", false, "Show nats-top version.")

flag.BoolVar(&displaySubscriptionsColumn, "u", false, "Same as --display-subscriptions-column.")
flag.BoolVar(&displaySubscriptionsColumn, "display-subscriptions-column", false, "Display subscriptions-column upon launch.")

log.SetFlags(0)
flag.Usage = usage
flag.Parse()
Expand Down Expand Up @@ -103,7 +106,7 @@ func main() {
}
engine.SortOpt = sortOpt

if *displaySubscriptionsColumn {
if displaySubscriptionsColumn {
engine.DisplaySubs = true
}

Expand Down
10 changes: 9 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ and releases of the binary are also [available](https://github.com/nats-io/nats-

```
usage: nats-top [-s server] [-m http_port] [-ms https_port] [-n num_connections] [-d delay_secs] [-r max] [-o FILE] [-l DELIMITER] [-sort by]
[-cert FILE] [-key FILE ][-cacert FILE] [-k] [-b]
[-cert FILE] [-key FILE ][-cacert FILE] [-k] [-b] [-v|--version] [-u|--display-subscriptions-column]
```

- `-m http_port`, `-ms https_port`
Expand Down Expand Up @@ -84,6 +84,14 @@ usage: nats-top [-s server] [-m http_port] [-ms https_port] [-n num_connections]

Displays traffic in raw bytes.

- `-v|--version`

Displays the version of nats-top.

- `-u|--display-subscriptions-column`

Makes the subscriptions-column immediately visible upon launching nats-top.

## Commands

While in top view, it is possible to use the following commands:
Expand Down

0 comments on commit 2fce567

Please sign in to comment.