Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #5 from jairtrejo/feature-prefix

Add --prefix option
  • Loading branch information...
commit caf3ac139b8d1460c66c349343e1681acd1fbd54 2 parents 2f3a1cf + 5ec3c75
@programble authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.