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

feat(cli): order flags by categories #1168

Merged
merged 1 commit into from
Oct 17, 2019

Conversation

sh0rez
Copy link
Member

@sh0rez sh0rez commented Oct 17, 2019

We have many flags of the form <category>.<name>. This change orders them
groups flags by category.

All flags with no categories and all categories with a single flag only won't be
grouped and will be printed at the top:

Usage of /tmp/go-build531611363/b001/exe/promtail:
   -config.file string:
      yaml file to load
   -log.level value:
      Only log messages with the given severity or above. Valid levels: [debug, info, warn, error] (default info)
   -target.sync-period duration:
      Period to resync directories being watched and files being tailed. (default 10s)
   -version:
      Print this builds version information (default false)

 Client:
   -client.batch-size-bytes int:
      Maximum batch size to accrue before sending.  (default 102400)
   -client.batch-wait duration:
      Maximum wait period before sending batch. (default 1s)
   -client.external-labels value:
      list of external labels to add to each log (e.g: --client.external-labels=lb1=v1,lb2=v2)
   -client.max-backoff duration:
      Maximum backoff time between retries. (default 5s)
   -client.max-retries int:
      Maximum number of retires when sending batches. (default 5)
   -client.min-backoff duration:
      Initial backoff time between retries. (default 100ms)
   -client.timeout duration:
      Maximum time to wait for server to respond to a request (default 10s)
   -client.url value:
      URL of log server

 Positions:
   -positions.file string:
      Location to read/write positions from. (default /var/log/positions.yaml)
   -positions.sync-period duration:
      Period with this to sync the position file. (default 10s)

 Server:
   -server.graceful-shutdown-timeout duration:
      Timeout for graceful shutdowns (default 30s)
   -server.grpc-listen-host string:
      gRPC server listen host.
   -server.grpc-listen-port int:
      gRPC server listen port. (default 9095)
   -server.grpc-max-concurrent-streams uint:
      Limit on the number of concurrent streams for gRPC calls (0 = unlimited) (default 100)
   -server.grpc-max-recv-msg-size-bytes int:
      Limit on the size of a gRPC message this server can receive (bytes). (default 4194304)
   -server.grpc-max-send-msg-size-bytes int:
      Limit on the size of a gRPC message this server can send (bytes). (default 4194304)
   -server.http-idle-timeout duration:
      Idle timeout for HTTP server (default 2m0s)
   -server.http-listen-host string:
      HTTP server listen host.
   -server.http-listen-port int:
      HTTP server listen port. (default 80)
   -server.http-read-timeout duration:
      Read timeout for HTTP server (default 30s)
   -server.http-write-timeout duration:
      Write timeout for HTTP server (default 30s)
   -server.path-prefix string:
      Base path to serve all API routes from (e.g. /v1/)
   -server.register-instrumentation:
      Register the intrumentation handlers (/metrics etc). (default true)

exit status 2

Don't know if it's cool, wanted to try it

We have many flags of the form `<category>.<name>`. This change orders them
groups flags by category.

All flags with no categories and all categories with a single flag only won't be
grouped and will be printed at the top
@sh0rez sh0rez added the type/enhancement Something existing could be improved label Oct 17, 2019
@sh0rez sh0rez self-assigned this Oct 17, 2019
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

Cool for me !

@cyriltovena cyriltovena merged commit de040ca into grafana:master Oct 17, 2019
@sh0rez sh0rez deleted the flagCategories branch October 17, 2019 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Something existing could be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants