### Home Classes Methods

### In Files

- lib/plugins/defaults/command_line.rb
- lib/plugins/another_prompt.rb

### Parent

Object

### Methods

- ::start
- ::stop
- #call
- #call_prompt
- #prompt
- #start
- #stop
- #wait_keypress

### Included Modules

- Singleton

### Files

- ChangeLog
- README.rdoc

### Class/Module Index

Quicksearch

- Termtter
- Termtter::API
- Termtter::ActiveRubytter
- Termtter::Client
- Termtter::Client::DirectMessage
- Termtter::Client::Jakigan
- Termtter::Client::SearchEvent
- Termtter::Client::UserSearchEvent
- Termtter::Command
- Termtter::CommandCanceled
- Termtter::CommandLine
- Termtter::CommandNotFound
- Termtter::Config
- Termtter::ConfigSetup
- Termtter::Crypt
- Termtter::English
- Termtter::Event
- Termtter::HTTPpool
- Termtter::Hook
- Termtter::HookCanceled
- Termtter::Hookable
- Termtter::JSONError
- Termtter::MemoryCache
- Termtter::MemoryCache::MemCacheMock
- Termtter::OptParser
- Termtter::Plugin
- Termtter::Plugin::Screen
- Termtter::Plugins
- Termtter::Plugins::Haml
- Termtter::Plugins::ListSwitch
- Termtter::RubytterProxy
- Termtter::RubytterProxy::FrequentAccessError
- Termtter::RubytterProxy::LimitManager
- Termtter::Status
- Termtter::StdOut
- Termtter::Storage
- Termtter::Storage::SQLite3
- Termtter::Storage::Status
- Termtter::Task
- Termtter::TaskManager
- Termtter::TypableIdGenerator
- Termtter::UserStreamReceiver
- Yharian
- Yharian::Alex
- Yharian::Jenifer
- Yharian::Remark
- Yharian::Speaker
- Yharian::Vicki
- Yharian::Yhara
- HatenaKeywordHaiku
- HatenaKeywordHaiku::Word
- OAuth
- OAuth::AccessToken
- Readline
- Readline::LIBREADLINE
- AAMaker
- Array
- BrowserNotFound
- Growl
- IRB
- Object
- Status
- String
- Symbol
- TermColor
- TermtterIrcGateway
- User

No matching classes.

# Termtter::CommandLine

### Constants

STTY_ORIGIN
TIOCGWINSZ

### Public Class Methods

start() click to toggle source

    # File lib/plugins/defaults/command_line.rb, line 8
    def start
      instance.start
    end

stop() click to toggle source

    # File lib/plugins/defaults/command_line.rb, line 12
    def stop
      instance.stop
    end

### Public Instance Methods

call(command_text) click to toggle source

    # File lib/plugins/defaults/command_line.rb, line 25
    def call(command_text)
      # Example:
      # t.register_hook(:post_all, :point => :prepare_command) do |s|
      #   "update #{s}"
      # end
      Client.get_hooks('prepare_command').each {|hook|
        command_text = hook.call(command_text)
      }
      Client.execute(command_text)
    rescue CommandNotFound => e
      hooks = Client.get_hooks('command_not_found')
      raise e if hooks.empty?
      hooks.each {|hook|
        hook.call(command_text)
      }
    rescue TimeoutError
      puts TermColor.parse("<red>Time out :(</red>")
    end

call_prompt(command) click to toggle source

    # File lib/plugins/another_prompt.rb, line 94
    def call_prompt(command)
      Client.execute("curry #{command}")
      if buf = Readline.readline(ERB.new(prompt).result(Termtter::API.twitter.__send__(:binding)), true)
        Readline::HISTORY.pop if buf.empty?
        begin
          call(buf)
        rescue Exception => e
          Client.handle_error(e)
        end
      else
        puts
      end
    ensure
      Client.execute('uncurry')
    end

prompt() click to toggle source

    # File lib/plugins/defaults/command_line.rb, line 44
    def prompt
      prompt_text = config.prompt
      Client.get_hooks('prepare_prompt').each {|hook|
        prompt_text = hook.call(prompt_text)
      }
      prompt_text
    end

start() click to toggle source

    # File lib/plugins/defaults/command_line.rb, line 17
    def start
      start_input_thread
    end

stop() click to toggle source

    # File lib/plugins/defaults/command_line.rb, line 21
    def stop
      @input_thread.kill if @input_thread
    end

wait_keypress() click to toggle source

    # File lib/plugins/another_prompt.rb, line 110
    def wait_keypress
      system('stty', '-echo', '-icanon')
      c = STDIN.getc
      return [c].pack('c')
    ensure
      system('stty', STTY_ORIGIN)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.