Module: Chitin::Builtins

Extended by:
Builtins
Includes:
Aliases, ExecutableBinaries, Prompts
Included in:
Builtins
Defined in:
lib/chitin/commands/builtins.rb

Defined Under Namespace

Modules: Aliases, ExecutableBinaries, Prompts

Constant Summary

Constants included from ExecutableBinaries

ExecutableBinaries::COMMANDS, ExecutableBinaries::PRIORITY_METHODS

Instance Method Summary collapse

Methods included from ExecutableBinaries

#lookup, #method_missing, #path_for_exec, #raw_exec

Methods included from Aliases

#all, #c, #cd, #exeunt, #gem, #la, #ll, #p, #pwd, #short_pwd, #to_num, #x

Methods included from Prompts

#prompt

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chitin::Builtins::ExecutableBinaries

Instance Method Details

#`(args) ⇒ Object

ruby’s backtick doesn’t chomp off the newline, which makes it more or less useless for piping into other commands



50
# File 'lib/chitin/commands/builtins.rb', line 50

def `(args); super(args).chomp; end

#bind(key, &action) ⇒ Object

interface to Coolline



13
14
15
16
# File 'lib/chitin/commands/builtins.rb', line 13

def bind(key, &action)
  cool = defined?(SESSION) ? SESSION : Coolline
  cool.bind(key, &action)
end

#completion_proc(&block) ⇒ Object



18
19
20
# File 'lib/chitin/commands/builtins.rb', line 18

def completion_proc(&block)
  @completion_proc = block
end

#post_process(label = :default, &block) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/chitin/commands/builtins.rb', line 40

def post_process(label=:default, &block)
  if label == :default
    post_processing[label] << block
  else
    post_processing[label] = block
  end
end

#post_processingObject



34
35
36
37
38
# File 'lib/chitin/commands/builtins.rb', line 34

def post_processing
  @post_processing ||= {:default => []}
  @post_processing.default = Proc.new {|*args| args.size > 1 ? args : args.first }
  @post_processing
end

#pre_process(label = :default, &block) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/chitin/commands/builtins.rb', line 26

def pre_process(label=:default, &block)
  if label == :default
    pre_processing[label] << block
  else
    pre_processing[label] = block
  end
end

#pre_processingObject



22
23
24
# File 'lib/chitin/commands/builtins.rb', line 22

def pre_processing
  @pre_processing ||= {:default => []}
end