Skip to content

.move method work like copy #9

Description

@Akiyamka

Api is misleading in some places.

Move it's copy

.move([ './some', './files' ], '../in/this/dir')
Files are expected to be moved to a ../in/this/dir directory, but instead they will be copied.

I suggest calling it "copy":

.copy([ './some', './files' ], '../in/this/dir');

Move method missed

Some time we need realy just move file to another dir.
Of course a method that really moves files mut be with name ".move".
In addition, this method can replace .rename method, just like a mv utility does in Unix systems:

Moving:

.move(['./someFile.js', './someAnotherFile.js'],  './someFolder/')`;

Renaming:

.move(['./folder/someOldName.js'],  './folder/someNewName.js');

Ambiguous api

Another problem is { from: ..., to: ... } syntax:

  .move((answers) => [
    {from: './' + answers.style, to: 'style/' + answers.style}
  ], '../../fake/destination')

There is no unambiguous interpretation of what a this command may mean.
This can mean - rename file from first name to second name, but we already have .rename function, hmm...
Or maybe this mean I can move the file from one to another directory!
Oh, but why then need a second argument in this case?
It frustrates me very much.

Semi-dynamics

I can use answers and arrays in first argument but can't in second - this is pretty weird.
I will write more about this in a separate issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions