Class: Archive::Tar::Minitar::Command::CommandHelp

Inherits:
CommandPattern show all
Defined in:
lib/minitar/command.rb

Instance Method Summary collapse

Methods inherited from CommandPattern

<<, [], #[], add, command, command?, default_ioe

Instance Method Details

#call(args, opts = {}, ioe = {}) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/minitar/command.rb', line 312

def call(args, opts = {}, ioe = {})
  ioe = CommandPattern.default_ioe(ioe)

  help_on = args.shift

  if CommandPattern.command?(help_on)
    ioe[:output] << CommandPattern[help_on].help
  elsif help_on == "commands"
    ioe[:output] << "The commands known to minitar are:\n\nminitar create          Creates a new tarfile.\nminitar extract         Extracts files from a tarfile.\nminitar list            Lists files in the tarfile.\n\nAll commands accept the options --verbose and --progress, which are\nmutually exclusive. In \"minitar list\", --progress means the same as\n--verbose.\n\n  --verbose, -V     Performs the requested command verbosely.\n  --progress, -P    Shows a progress bar, if appropriate, for the action\n                being performed.\n\n    EOH\n  else\n    ioe[:output] << \"Unknown command: \#{help_on}\\n\" unless help_on.nil? or help_on.empty?\n    ioe[:output] << self.help\n  end\n\n  0\nend\n"

#helpObject



344
345
346
347
348
349
350
351
352
353
# File 'lib/minitar/command.rb', line 344

def help
  help = "This is a basic help message containing pointers to more information on\nhow to use this command-line tool. Try:\n\nminitar help commands       list all 'minitar' commands\nminitar help <COMMAND>      show help on <COMMAND>\n                              (e.g., 'minitar help create')\n  EOH\nend\n"

#nameObject



308
309
310
# File 'lib/minitar/command.rb', line 308

def name
  "help"
end