Module: Ripl::Fresh::Commands
- Defined in:
- lib/ripl/fresh/commands.rb
Instance Method Summary collapse
Instance Method Details
#cd(path = File.expand_path('~')) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ripl/fresh/commands.rb', line 7 def cd( path = File.('~') ) new_last_path = FileUtils.pwd if path =~ /^\.{3,}$/ path = File.join( %w[..] * ($&.size-1) ) elsif path == '-' if @last_path path = @last_path else warn 'Sorry, there is no previous directory.' return end end FileUtils.cd path @last_path = new_last_path nil end |