Skip to content
Snippets Groups Projects
Commit 844e9452 authored by Adam Vandenberg's avatar Adam Vandenberg
Browse files

return found path directly in which

parent 5f8e7815
No related branches found
No related tags found
No related merge requests found
......@@ -170,11 +170,11 @@ def puts_columns items, star_items=[]
end
def which cmd, path=ENV['PATH']
dir = path.split(File::PATH_SEPARATOR).find {|p|
path.split(File::PATH_SEPARATOR).find do |p|
pcmd = File.join(p, cmd)
File.executable?(pcmd) && !File.directory?(pcmd)
}
Pathname.new(File.join(dir, cmd)) unless dir.nil?
return pcmd if File.executable?(pcmd) && !File.directory?(pcmd)
end
return nil
end
def which_editor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment