Class: Rbnotes::Commands::Help

Inherits:
Command
  • Object
show all
Defined in:
lib/rbnotes/commands/help.rb

Overview

Shows help message for the command which specifies with the argument.

Instance Method Summary collapse

Instance Method Details

#descriptionObject

:nodoc:



9
10
11
# File 'lib/rbnotes/commands/help.rb', line 9

def description             # :nodoc:
  "Print help of each command"
end

#execute(args, conf) ⇒ Object

:call-seq:

execute(["add"], Rbnotes::Conf or Hash) -> nil
execute(["delete"], Rbnotes::Conf or Hash) -> nil


18
19
20
21
22
23
24
25
26
# File 'lib/rbnotes/commands/help.rb', line 18

def execute(args, conf)
  cmd_name = args.shift
  case cmd_name
  when nil
    self.help
  else
    Commands.load(cmd_name).help
  end
end

#helpObject

:nodoc:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rbnotes/commands/help.rb', line 28

def help                    # :nodoc:
  puts "\#{Rbnotes::NAME.capitalize} is a simple tool to write a note into a single repository.\n\nWhen creates a new note, a timestamp is attached to the note.  \#{Rbnotes::NAME.capitalize}\nmanages notes with those timestamps, such update, delete, ...etc.\n\nTimestamp is a series of digits which represents year, date, and time.\nIt looks like \"20201106121100\", means \"2020-11-06 12:11:00\".  It is\ngenerated in the local time.\n\nusage:\n\#{Rbnotes::NAME} [option] [command] [args]\n\noption:\n-c, --conf [CONF_FILE] : specifiy the configuration file\n-v, --version          : print version\n-h, --help             : show this message\n\nCONF_FILE must be written in YAML.  To know about details of the\nconfiguration file, see README.md or Wiki page.\n\nFurther help:\n\#{Rbnotes::NAME} help commands\n\#{Rbnotes::NAME} help COMMAND\n\#{Rbnotes::NAME} usage\n\nFurther information:\nhttps://github.com/mnbi/rbnotes/wiki\n"
end