Class: SkipDirCli
- Inherits:
-
Thor
- Object
- Thor
- SkipDirCli
- Defined in:
- bin/sd
Constant Summary collapse
- LOCATION =
"#{Dir.home}/.skipdir"
Instance Method Summary collapse
Instance Method Details
#add(name, dir = Dir.pwd) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'bin/sd', line 11 def add(name, dir=Dir.pwd) if name.strip.split(' ').size > 1 STDERR.puts 'Spaces not allowed for aliases' end puts "Adding alias '#{name}' => '#{dir}'" @skipdir = SkipDir.new(LOCATION) @skipdir.add name, dir end |
#go(name) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'bin/sd', line 22 def go(name) @skipdir = SkipDir.new(LOCATION) dir = @skipdir.get name if dir.nil? STDERR.puts "Alias #{name} not found" else Dir.chdir(dir) end end |