Module: Bovem::ShellMethods::Write

Included in:
Bovem::Shell
Defined in:
lib/bovem/shell.rb

Overview

Methods to copy or move entries.

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) copy(src, dst, run: true, show_errors: false, fatal_errors: true)

Copies a set of files or directory to another location.

Parameters:

  • src (String|Array)

    The entries to copy. If is an Array, dst is assumed to be a directory.

  • dst (String)

    The destination. Any existing entries will be overwritten. Any required directory will be created.

  • run (Boolean)

    If false, it will just print a list of message that would be copied or moved.

  • show_errors (Boolean)

    If show errors.

  • fatal_errors (Boolean)

    If quit in case of fatal errors.

Returns:

  • (Boolean)

    true if operation succeeded, false otherwise.



142
143
144
# File 'lib/bovem/shell.rb', line 142

def copy(src, dst, run: true, show_errors: false, fatal_errors: true)
  copy_or_move(src, dst, operation: :copy, run: run, show_errors: show_errors, fatal_errors: fatal_errors)
end

- (Boolean) move(src, dst, run: true, show_errors: false, fatal_errors: true)

Moves a set of files or directory to another location.

Parameters:

  • src (String|Array)

    The entries to move. If is an Array, dst is assumed to be a directory.

  • dst (String)

    The destination. Any existing entries will be overwritten. Any required directory will be created.

  • run (Boolean)

    If false, it will just print a list of message that would be deleted.

  • show_errors (Boolean)

    If show errors.

  • fatal_errors (Boolean)

    If quit in case of fatal errors.

Returns:

  • (Boolean)

    true if operation succeeded, false otherwise.



154
155
156
# File 'lib/bovem/shell.rb', line 154

def move(src, dst, run: true, show_errors: false, fatal_errors: true)
  copy_or_move(src, dst, operation: :move, run: run, show_errors: show_errors, fatal_errors: fatal_errors)
end