Class: Ki::KiCommandHelp

Inherits:
Object show all
Defined in:
lib/cmd/cmd.rb

Overview

Displays help for given command

Instance Method Summary collapse

Instance Method Details

#execute(ctx, args) ⇒ Object

Finds matching command and displays its help



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cmd/cmd.rb', line 154

def execute(ctx, args)
  if args.size == 1
    puts ctx.find_cmd(args.first).help
    puts "Common ki options:\n#{ctx.opts}"
  else
    finder = ctx.ki_home.finder
    puts <<EOF
ki-repo is a repository for storing packages and metadata.

#{help}
Info:
  Home directory: #{ctx.ki_home.path}
  Repositories:
#{finder.all_repositories.map { |repo| "    - #{repo.path} (components: #{repo.components.size})" }.join("\n")}
  Components in all repositories: #{finder.components.size}

Available commands:
EOF
    KiInfoCommand.new.execute(ctx, ["-c"])

    puts "\nRun '#{$0} help COMMAND' for more information about that command."
  end
end

#helpObject



178
179
180
181
182
183
184
185
186
187
# File 'lib/cmd/cmd.rb', line 178

def help
<<EOF
"#{shell_command}" shows information Ki and its commands.

### Examples

#{shell_command}
#{shell_command} version-build
EOF
end