summaryrefslogtreecommitdiff
path: root/lib/un.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/un.rb')
-rw-r--r--lib/un.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/un.rb b/lib/un.rb
index 5feac92120..8fb3c61a93 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -30,7 +30,6 @@ require "fileutils"
require "optparse"
module FileUtils
-# @fileutils_label = ""
@fileutils_output = $stdout
end
@@ -79,13 +78,15 @@ end
#
# -p preserve file attributes if possible
# -r copy recursively
+# -l make hard link instead of copying (implies -r)
# -v verbose
#
def cp
- setup("pr") do |argv, options|
+ setup("prl") do |argv, options|
cmd = "cp"
cmd += "_r" if options.delete :r
+ cmd = "cp_lr" if options.delete :l
options[:preserve] = true if options.delete :p
dest = argv.pop
argv = argv[0] if argv.size == 1
@@ -254,7 +255,7 @@ def wait_writable
wait = (wait = options[:w]) ? Float(wait) : 0.2
argv.each do |file|
begin
- open(file, "r+b")
+ File.open(file, "r+b") {}
rescue Errno::ENOENT
break
rescue Errno::EACCES => e
@@ -410,6 +411,9 @@ def help
end
module UN # :nodoc:
+
+ VERSION = "0.3.0"
+
module_function
def help(argv, output: $stdout)
all = argv.empty?
@@ -420,7 +424,7 @@ module UN # :nodoc:
messages = {}
store = proc {|msg| messages[cmd] = msg}
end
- open(__FILE__) do |me|
+ File.open(__FILE__) do |me|
while me.gets("##\n")
if help = me.gets("\n\n")
if all or argv.include?(cmd = help[/^#\s*ruby\s.*-e\s+(\w+)/, 1])