7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/hfam/commands/symlink.rb', line 7
def run(command)
src = command[1]
::HFAM::Logger.error("No such file or directory: #{src}") and return unless File.exist? src
file = src.split('/').last
file = ::FileUtils.hidden_file?(file) ? file : ".#{file}"
dest = "#{command[2]}/#{file}"
::FileUtils.ln_sf(src, dest)
::HFAM::Logger.success("Symlink: ln -s #{src} #{dest}")
rescue ::Errno::EACCES => e
l::HFAM::Logger.error("Unable to generate symlink #{src} #{dest} (Permission Denied)")
end
|