Module: Chitin::Builtins::Aliases

Included in:
Chitin::Builtins
Defined in:
lib/chitin/commands/builtins.rb

Overview

I’m putting these in their own module so that you can compress them easily using code folding. Sinatra-style, baby.

Instance Method Summary collapse

Instance Method Details

#allObject



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

def all; D('.'); end

#cObject



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

def c; clear; end

#cd(path = ) ⇒ Object

Basic helper commands for shell usability



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

def cd(path=ENV['HOME']); Dir.chdir path; pwd; end

#exeuntObject



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

def exeunt; puts 'Fare thee well...'; exit 0; end

#gem(*a) ⇒ Object



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

def gem(*a); raw_exec("gem", *a); end

#la(*a) ⇒ Object



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

def la(*a); ls '-haGl', *a; end

#ll(*a) ⇒ Object



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

def ll(*a); ls '-hGl', *a; end

#p(*args) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/chitin/commands/builtins.rb', line 135

def p(*args)
  args.map do |arg|
    if Runnable === arg
      puts arg[:inspect]
    else
      puts arg.inspect
    end
  end

  # i know puts returns nil, but this is to emphasize
  # the fact that we want it to return nil
  nil 
end

#pwdObject



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

def pwd; Dir.pwd; end

#short_pwdObject



121
122
123
124
# File 'lib/chitin/commands/builtins.rb', line 121

def short_pwd
  home = ENV['HOME']
  pwd.start_with?(home) ? pwd.sub(home, '~') : pwd
end

#to_numObject



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

def to_num; L {|i| i.to_i }; end

#xObject



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

def x; exeunt; end