Skip to content

Commit

Permalink
Refactor commands descriptions (#1585)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay authored Jun 5, 2019
1 parent d994244 commit 09dad38
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func main() {
Use: "jaeger-all-in-one",
Short: "Jaeger all-in-one distribution with agent, collector and query in one process.",
Long: `Jaeger all-in-one distribution with agent, collector and query. Use with caution this version
uses only in-memory database.`,
by default uses only in-memory database.`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := svc.Start(v); err != nil {
return err
Expand Down
38 changes: 22 additions & 16 deletions cmd/env/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,33 @@ import (
"github.com/jaegertracing/jaeger/plugin/storage"
)

const (
longTemplate = `
All command line options can be provided via environment variables by converting
their names to upper case and replacing punctuation with underscores. For example:
command line option environment variable
------------------------------------------------------------------
--cassandra.connections-per-host CASSANDRA_CONNECTIONS_PER_HOST
--metrics-backend METRICS_BACKEND
The following configuration options are only available via environment variables:
%s
`
)

// Command creates `env` command
func Command() *cobra.Command {
fs := new(pflag.FlagSet)
fs.String(storage.SpanStorageTypeEnvVar, "cassandra", fmt.Sprintf("The type of backend %s used for trace storage. Multiple backends can be specified (currently only for writing spans) as comma-separated list, e.g. \"cassandra,kafka\".", storage.AllStorageTypes))
fs.String(storage.DependencyStorageTypeEnvVar, "${SPAN_STORAGE}", "The type of backend used for service dependencies storage.")
long := fmt.Sprintf(longTemplate, strings.Replace(fs.FlagUsagesWrapped(0), " --", "", -1))
return &cobra.Command{
Use: "env",
Short: "Help about environment variables",
Long: `Help about environment variables`,
Short: "Help about environment variables.",
Long: long,
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintln(cmd.OutOrStdout(), `
All command line options can be provided via environment variables by converting
their names to upper case and replacing punctuation with underscores. For example,
command line option environment variable
------------------------------------------------------------------
--cassandra.connections-per-host CASSANDRA_CONNECTIONS_PER_HOST
--metrics-backend METRICS_BACKEND
The following configuration options are only available via environment variables:`+"\n")
fs := new(pflag.FlagSet)
fs.String(storage.SpanStorageTypeEnvVar, "cassandra", fmt.Sprintf("The type of backend %s used for trace storage. Multiple backends can be specified (currently only for writing spans) as comma-separated list, e.g. \"cassandra,kafka\".", storage.AllStorageTypes))
fs.String(storage.DependencyStorageTypeEnvVar, "${SPAN_STORAGE}", "The type of backend used for service dependencies storage.")
fmt.Fprintln(cmd.OutOrStdout(), strings.Replace(fs.FlagUsagesWrapped(1000), " --", " ", -1))
fmt.Fprintf(cmd.OutOrStdout(), long)
},
}
}
6 changes: 3 additions & 3 deletions cmd/ingester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func main() {

v := viper.New()
command := &cobra.Command{
Use: "(experimental) jaeger-ingester",
Short: "Jaeger ingester consumes from Kafka and writes to storage",
Long: `Jaeger ingester consumes spans from a particular Kafka topic and writes them to all configured storage types.`,
Use: "jaeger-ingester",
Short: "(experimental) Jaeger ingester consumes from Kafka and writes to storage.",
Long: `Jaeger ingester consumes spans from a particular Kafka topic and writes them to a configured storage.`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := svc.Start(v); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/version/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
func Command() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print the version",
Long: `Print the version and build information`,
Short: "Print the version.",
Long: `Print the version and build information.`,
RunE: func(cmd *cobra.Command, args []string) error {
info := Get()
json, err := json.Marshal(info)
Expand Down

0 comments on commit 09dad38

Please sign in to comment.