Sha256: e966a415a87d922e34a76d158ee6dfeac7ee27ce897e62c9554254efc19b8e24

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 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"
      cut!
    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."
      cut!
    else
      true
    end
    
  end
  
  c.on_run do |opts, args|
    opts.merge!(:rename => true)
    Amp::Command["copy"].run(opts, args)
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp-0.5.3 lib/amp/commands/commands/workflows/hg/move.rb