Module: CultomePlayer::Plugins::Help

Included in:
CultomePlayer::Plugins
Defined in:
lib/cultome_player/plugins/help.rb

Instance Method Summary collapse

Instance Method Details

#command_help(cmd) ⇒ Response

Command implementation for action “help”. Shows usage information for the actions of the player if called with an action as parameter and shows a player usage information if called without parameters.

Parameters:

  • cmd (Command)

    Command information parsed from user input

Returns:

  • (Response)

    Contains a message to be displayed with the help required.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cultome_player/plugins/help.rb', line 11

def command_help(cmd)
	if cmd.params.empty?
		success(message: usage_cultome_player)
	else
		help = send("usage_#{cmd.params.first.value}")
		if help.nil?
			failure("No help is available for '#{cmd.params.first.value}'.")
		else
			success(message: help)
		end
	end
end

#description_helpString

Description of the action help.

Returns:

  • (String)

    The description of the action.



32
33
34
# File 'lib/cultome_player/plugins/help.rb', line 32

def description_help
	"Provides information for player features."
end

#sintax_helpObject



24
25
26
# File 'lib/cultome_player/plugins/help.rb', line 24

def sintax_help
	/^literal (literal)$/
end

#usage_helpString

Returns The usage information of the action.

Returns:

  • (String)

    The usage information of the action.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cultome_player/plugins/help.rb', line 40

def usage_help
	return <<-USAGE
usage: help [command]

Provides usage information for player commands. If called without parameters, shows the player usage.

Examples:

To see all the commands availables in the player:
	help

To see the usage for play command:
	help play

	USAGE
end