Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions commands/list_formatters.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (f *TXTListFormatter) Format(list *List, cnf *config.Config) ([]byte, error
if len(cmd.Aliases) > 0 {
name = name + " (" + strings.Join(cmd.Aliases, ", ") + ")"
}
fmt.Fprintf(writer, " %s\t%s\n", name, cmd.Description.String())
fmt.Fprintf(writer, " %s\t%s\n", name, cmd.Description)
}
}
writer.Flush()
Expand All @@ -86,7 +86,7 @@ func (f *RawListFormatter) Format(list *List, _ *config.Config) ([]byte, error)
var b bytes.Buffer
writer := tabwriter.NewWriter(&b, 0, 8, 16, ' ', 0)
for _, cmd := range list.Commands {
fmt.Fprintf(writer, "%s\t%s\n", cmd.Name.String(), cmd.Description.String())
fmt.Fprintf(writer, "%s\t%s\n", cmd.Name.String(), cmd.Description)
}
writer.Flush()

Expand Down Expand Up @@ -122,7 +122,7 @@ func (f *MDListFormatter) Format(list *List, cnf *config.Config) ([]byte, error)

for _, cmd := range list.Commands {
b.H2(md.Code(cmd.Name.String()))
b.Paragraph(cmd.Description.String()).Ln()
b.Paragraph(cmd.Description).Ln()

if len(cmd.Aliases) > 0 {
aliases := make([]string, 0, len(cmd.Aliases))
Expand All @@ -141,13 +141,12 @@ func (f *MDListFormatter) Format(list *List, cnf *config.Config) ([]byte, error)
}

if cmd.Help != "" {
b.Paragraph(cmd.Help.String()).Ln()
b.Paragraph(cmd.Help).Ln()
}

if cmd.Definition.Arguments != nil && cmd.Definition.Arguments.Len() > 0 {
if len(cmd.Definition.Arguments) > 0 {
b.H4("Arguments")
for pair := cmd.Definition.Arguments.Oldest(); pair != nil; pair = pair.Next() {
arg := pair.Value
for _, arg := range cmd.Definition.Arguments {
line := md.Code(arg.Name)
opts := make([]string, 0, 2)
if arg.IsRequired {
Expand All @@ -162,15 +161,14 @@ func (f *MDListFormatter) Format(list *List, cnf *config.Config) ([]byte, error)

b.ListItem(line)
if arg.Description != "" {
b.Paragraph(" " + arg.Description.String()).Ln()
b.Paragraph(" " + arg.Description).Ln()
}
}
}

if cmd.Definition.Options != nil && cmd.Definition.Options.Len() > 0 {
if len(cmd.Definition.Options) > 0 {
b.H4("Options")
for pair := cmd.Definition.Options.Oldest(); pair != nil; pair = pair.Next() {
opt := pair.Value
for _, opt := range cmd.Definition.Options {
line := md.Code(opt.Name)
if opt.Shortcut != "" {
line += " (" + md.Code(opt.Shortcut) + ")"
Expand All @@ -180,15 +178,15 @@ func (f *MDListFormatter) Format(list *List, cnf *config.Config) ([]byte, error)
}
b.ListItem(line)
if opt.Description != "" {
b.Paragraph(" " + opt.Description.String()).Ln()
b.Paragraph(" " + opt.Description).Ln()
}
}
}

if len(cmd.Examples) > 0 {
b.H3("Examples")
for _, example := range cmd.Examples {
b.ListItem(example.Description.String() + ":")
b.ListItem(example.Description + ":")
b.CodeBlock(cnf.Application.Executable + " " + cmd.Name.String() + " " + example.Commandline).Ln()
}
}
Expand Down
24 changes: 11 additions & 13 deletions commands/list_input_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package commands
import (
"fmt"

"github.com/fatih/color"

"github.com/platformsh/cli/internal/config"
)

Expand All @@ -29,10 +27,10 @@ func NoInteractionOption(cnf *config.Config) Option {
AcceptValue: false,
IsValueRequired: false,
IsMultiple: false,
Description: CleanString("Do not ask any interactive questions; accept default values. " +
Description: "Do not ask any interactive questions; accept default values. " +
"Equivalent to using the environment variable: " +
color.YellowString(fmt.Sprintf("%sNO_INTERACTION=1", cnf.Application.EnvPrefix))),
Default: Any{false},
fmt.Sprintf("%sNO_INTERACTION=1", cnf.Application.EnvPrefix),
Default: false,
Hidden: false,
}
}
Expand All @@ -45,7 +43,7 @@ var (
IsValueRequired: false,
IsMultiple: false,
Description: "Display this help message",
Default: Any{false},
Default: false,
Hidden: false,
}
VerboseOption = Option{
Expand All @@ -55,7 +53,7 @@ var (
IsValueRequired: false,
IsMultiple: false,
Description: "Increase the verbosity of messages",
Default: Any{false},
Default: false,
Hidden: false,
}
VersionOption = Option{
Expand All @@ -65,7 +63,7 @@ var (
IsValueRequired: false,
IsMultiple: false,
Description: "Display this application version",
Default: Any{false},
Default: false,
Hidden: false,
}
YesOption = Option{
Expand All @@ -76,7 +74,7 @@ var (
IsMultiple: false,
Description: "Answer \"yes\" to confirmation questions; " +
"accept the default value for other questions; disable interaction",
Default: Any{false},
Default: false,
Hidden: false,
}
AnsiOption = Option{
Expand All @@ -86,7 +84,7 @@ var (
IsValueRequired: false,
IsMultiple: false,
Description: "Force ANSI output",
Default: Any{false},
Default: false,
Hidden: true,
}
NoAnsiOption = Option{
Expand All @@ -96,7 +94,7 @@ var (
IsValueRequired: false,
IsMultiple: false,
Description: "Disable ANSI output",
Default: Any{false},
Default: false,
Hidden: true,
}
NoOption = Option{
Expand All @@ -107,7 +105,7 @@ var (
IsMultiple: false,
Description: "Answer \"no\" to confirmation questions; " +
"accept the default value for other questions; disable interaction",
Default: Any{false},
Default: false,
Hidden: true,
}
QuietOption = Option{
Expand All @@ -117,7 +115,7 @@ var (
IsValueRequired: false,
IsMultiple: false,
Description: "Do not output any message",
Default: Any{false},
Default: false,
Hidden: true,
}
)
Loading