-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <[email protected]>
- Loading branch information
1 parent
b271612
commit 693722f
Showing
4 changed files
with
43 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,30 +9,26 @@ const cli = meow(` | |
Options | ||
--no-overwrite Don't overwrite the destination | ||
--parents Preserve path structure | ||
--cwd=<dir> Working directory for files | ||
--rename=<filename> Rename all <source> filenames to <filename> | ||
--dot Allow patterns to match entries that begin with a period (.) | ||
--flat Flatten directory structure. All copied files will be put in the same directory. | ||
<source> can contain globs if quoted | ||
Examples | ||
Copy all .png files in src folder into dist except src/goat.png | ||
$ cpy 'src/*.png' '!src/goat.png' dist | ||
Copy all .html files inside src folder into dist and preserve path structure | ||
$ cpy '**/*.html' '../dist/' --cwd=src --parents | ||
Copy all files inside src folder into dist and preserve path structure | ||
$ cpy . '../dist/' --cwd=src | ||
`, { | ||
importMeta: import.meta, | ||
flags: { | ||
overwrite: { | ||
type: 'boolean', | ||
default: true, | ||
}, | ||
parents: { | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
cwd: { | ||
type: 'string', | ||
default: process.cwd(), | ||
|
@@ -44,6 +40,10 @@ const cli = meow(` | |
type: 'boolean', | ||
default: false, | ||
}, | ||
flat: { | ||
type: 'boolean', | ||
default: false, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sindresorhus
Author
Owner
|
||
}, | ||
}, | ||
}); | ||
|
||
|
@@ -52,9 +52,9 @@ const cli = meow(` | |
await cpy(cli.input, cli.input.pop(), { | ||
cwd: cli.flags.cwd, | ||
rename: cli.flags.rename, | ||
parents: cli.flags.parents, | ||
overwrite: cli.flags.overwrite, | ||
dot: cli.flags.dot, | ||
flat: cli.flags.flat, | ||
}); | ||
} catch (error) { | ||
if (error.name === 'CpyError') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@sindresorhus
Shouldn't it be set to
true
by default to make it more compliant to *nix cp util?