Skip to content
Browse files

Adds "prefix" option.

  • Loading branch information...
1 parent 2f3a1cf commit 5ec3c75c129766f1c1ccedbabcf3c6cb3d8def50 @jairtrejo jairtrejo committed Apr 21, 2012
Showing with 11 additions and 1 deletion.
  1. +2 −0 README.md
  2. +9 −1 bin/effuse
View
2 README.md
@@ -45,6 +45,8 @@ Usage: effuse [OPTION...] [DEST]
-y, --noconfirm CHOICE Assume CHOICE on file conflicts
-n, --no-backup Do not create backup files
+ -p --prefix PREFIX Prefix relative paths with PREFIX
+
-v, --verbose Show verbose output
-h, --help Show this message
```
View
10 bin/effuse
@@ -8,6 +8,7 @@ options = OpenStruct.new(:verbose => false,
:clean => false,
:noconfirm => nil,
:backup => true,
+ :prefix => "",
:exclude => %w[.effuseignore .git .gitignore .gitmodules *~ .*~ .*.swp])
if File.exist?('.effuseignore')
@@ -45,6 +46,12 @@ OptionParser.new do |o|
o.separator ''
+ o.on('-p', '--prefix PREFIX', 'Prefix relative paths with PREFIX') do |prefix|
+ options.prefix = prefix
+ end
+
+ o.separator ''
+
o.on('-v', '--verbose', 'Show verbose output') do
options.verbose = true
end
@@ -84,7 +91,8 @@ dirs.each do |dir|
end
puts "found #{file}" if options.verbose
- dest = File.join([dest_dir] + file.split('/')[1..-1])
+ relpath = file.split('/')[1..-1]
+ dest = File.join([dest_dir, options.prefix + relpath[0]] + relpath[1..-1])
files[File.expand_path(file)] = dest # Shakes fist at Ruby 1.8 (File.absolute_path)
end
end

0 comments on commit 5ec3c75

Please sign in to comment.
Something went wrong with that request. Please try again.