Module: Participle::CLI

Included in:
Bot
Defined in:
lib/cli.rb

Overview

The command-line interface for Participle.

Instance Method Summary (collapse)

Instance Method Details

- (void) add_cli_command(*triggers) {|bot, buffer, args| ... }

This method returns an undefined value.

Register a command for the command line interface.

Examples:

A 'google' command that queries Google for the characters currently typed in

add_cli_command("g", "google") {|bot, buffer, args|
  some_google_results = some_google_function(buffer)
  bot.say(some_google_results, bot.current_room)
}

Parameters:

  • triggers (Array)

    the strings to match this command to

Yields:

  • (bot, buffer, args)

    bot

    the currently running bot

    buffer

    the characters typed into the prompt

    args

    a list of arguments passed to the command



17
18
19
20
21
# File 'lib/cli.rb', line 17

def add_cli_command *triggers, &blk
  triggers.each{|t|
    @__cli_commands[t] = blk
  }
end