Sha256: 015b1184b93a7f6f1ff7cf6c48435d1cfecae15db424aab2381f877f01cbc981

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

command :copy do |c|
  c.workflow :git
  c.desc "Copies a file from one location to another, while maintaining history"
  c.opt :force, "Forces the copy, ignoring overwrites", :short => "-f"
  c.opt :"dry-run", "Doesn't actually move files - only prints what would happen", :short => "-n"
  c.synonym :cp
  c.before do |opts, args|
    if args.size < 2
      Amp::UI.say "Usage: amp copy source [other-sources...] destination"
      c.break
    elsif args.size > 2 && !File.directory?(args.last)
      Amp::UI.say "If you want to copy more than 1 file, your destination must" +
                  " be a directory."
      c.break
    end
  end
  
  c.on_run do |opts, args|
    repo = opts[:repository]
    
    sources = args[0..-2]
    destination = args.last
    sources.each do |source|
      repo.copy(source, destination, opts)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
amp-0.5.2 lib/amp/commands/commands/workflows/git/copy.rb
amp-0.5.1 lib/amp/commands/commands/workflows/git/copy.rb
amp-pure-0.5.0 lib/amp/commands/commands/workflows/git/copy.rb
amp-0.5.0 lib/amp/commands/commands/workflows/git/copy.rb