Skip to content
Merged
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
17 changes: 17 additions & 0 deletions spec/formatter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ private class GreetCommand < Cling::MainCommand
end
end

class WelcomeCommand < Cling::Command
def setup : Nil
@name = "welcome"
@summary = @description = "sends a friendly welcome message"
end

def run(arguments : Cling::Arguments, options : Cling::Options) : Nil
end
end

command = GreetCommand.new
command.add_command WelcomeCommand.new
formatter = Cling::Formatter.new

describe Cling::Formatter do
Expand All @@ -26,6 +37,9 @@ describe Cling::Formatter do
Usage:
\tgreet <arguments> [options]

Commands:
\twelcome sends a friendly welcome message

Arguments:
\tname the name of the person (required)

Expand All @@ -45,6 +59,9 @@ describe Cling::Formatter do
Usage:
\tgreet <arguments> [options]

Commands:
\twelcome sends a friendly welcome message

Arguments:
\tname the name of the person (required)

Expand Down
2 changes: 1 addition & 1 deletion src/cling/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module Cling
io << "Commands:"
commands.each do |cmd|
io << "\n\t"
if summary = command.summary
if summary = cmd.summary
cmd.name.ljust(io, max_space, ' ')
io << summary
else
Expand Down