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
- #all ⇒ Object
- #c ⇒ Object
-
#cd(path = ) ⇒ Object
Basic helper commands for shell usability.
- #exeunt ⇒ Object
- #gem(*a) ⇒ Object
- #la(*a) ⇒ Object
- #ll(*a) ⇒ Object
- #p(*args) ⇒ Object
- #pwd ⇒ Object
- #short_pwd ⇒ Object
- #to_num ⇒ Object
- #x ⇒ Object
Instance Method Details
#all ⇒ Object
178 |
# File 'lib/chitin/commands/builtins.rb', line 178 def all; D('.'); end |
#c ⇒ Object
175 |
# File 'lib/chitin/commands/builtins.rb', line 175 def c; clear; end |
#cd(path = ) ⇒ Object
Basic helper commands for shell usability
165 |
# File 'lib/chitin/commands/builtins.rb', line 165 def cd(path=ENV['HOME']); Dir.chdir path; pwd; end |
#exeunt ⇒ Object
173 |
# File 'lib/chitin/commands/builtins.rb', line 173 def exeunt; puts 'Fare thee well...'; exit 0; end |
#gem(*a) ⇒ Object
177 |
# File 'lib/chitin/commands/builtins.rb', line 177 def gem(*a); raw_exec("gem", *a); end |
#la(*a) ⇒ Object
172 |
# File 'lib/chitin/commands/builtins.rb', line 172 def la(*a); ls '-haGl', *a; end |
#ll(*a) ⇒ Object
171 |
# File 'lib/chitin/commands/builtins.rb', line 171 def ll(*a); ls '-hGl', *a; end |
#p(*args) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/chitin/commands/builtins.rb', line 181 def p(*args) args.map do |arg| if Runnable === arg puts arg[:inspect] else puts arg.inspect end end # i know puts returns nil and p returns the object, but this is to # emphasize the fact that we want it to return nil. also, so that # we don't accidentally run a Runnable while inspecting it nil end |
#pwd ⇒ Object
166 |
# File 'lib/chitin/commands/builtins.rb', line 166 def pwd; Dir.pwd; end |
#short_pwd ⇒ Object
167 168 169 170 |
# File 'lib/chitin/commands/builtins.rb', line 167 def short_pwd home = ENV['HOME'] pwd.start_with?(home) ? pwd.sub(home, '~') : pwd end |
#to_num ⇒ Object
180 |
# File 'lib/chitin/commands/builtins.rb', line 180 def to_num; L {|i| i.to_i }; end |
#x ⇒ Object
174 |
# File 'lib/chitin/commands/builtins.rb', line 174 def x; exeunt; end |