Sha256: dbeb76a3189818bd83fbcd83a773aa2797e948fb575b59508fddca4952d33d17

Contents?: true

Size: 743 Bytes

Versions: 4

Compression:

Stored size: 743 Bytes

Contents

command :move do |c|
  c.workflow :hg
  c.desc "Moves a file from one place to another"
  c.opt :force, "Forces the move, ignoring overwrites", :short => "-f"
  c.opt :"dry-run", "Doesn't actually move files - only prints what would happen", :short => "-n"
  
  c.synonym :mv
  c.synonym :rename
  
  c.before do |opts, args|
    if args.size < 2
      Amp::UI.say "Usage: amp move source destination"
      c.break
    elsif args.size > 2 && !File.directory?(args.last)
      Amp::UI.say "If you want to move more than 1 file, your destination must" +
                  " be a directory."
      c.break
    end
    true
  end
  
  c.on_run do |opts, args|
    opts.merge!(:rename => true)
    Amp::Command["copy"].run(opts, args)
  end
end


Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
amp-0.5.2 lib/amp/commands/commands/workflows/hg/move.rb
amp-0.5.1 lib/amp/commands/commands/workflows/hg/move.rb
amp-pure-0.5.0 lib/amp/commands/commands/workflows/hg/move.rb
amp-0.5.0 lib/amp/commands/commands/workflows/hg/move.rb