rclonefile-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/lib/index.js +51 -0
- package/package.json +19 -0
- package/tsconfig.json +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Sverre Johansen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# rclonefile-cli
|
|
2
|
+
|
|
3
|
+
Clone files.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
The macOS API for creating copy on write clones of files.
|
|
8
|
+
|
|
9
|
+
This is a small wrapper around the
|
|
10
|
+
[clonefile](https://www.manpagez.com/man/2/clonefile/) API on macOS for cloning
|
|
11
|
+
files.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
|
|
18
|
+
npm install --global rclonefile-cli
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
|
|
27
|
+
$ rclonefile --help
|
|
28
|
+
|
|
29
|
+
Usage
|
|
30
|
+
$ rclonefile <source> <destination>
|
|
31
|
+
|
|
32
|
+
Options
|
|
33
|
+
--no-follow, -f Don't follow the src file if it is a symbolic link
|
|
34
|
+
--no-owner-copy, -c Don't copy ownership information from the source
|
|
35
|
+
--clone-acl, -a Copy ACLs from the source file.
|
|
36
|
+
|
|
37
|
+
Examples
|
|
38
|
+
$ rclonefile super-mario.png super-clone.png
|
|
39
|
+
|
|
40
|
+
```
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import meow from "meow";
|
|
3
|
+
import { cloneFile } from "rclonefile";
|
|
4
|
+
const cli = meow(`
|
|
5
|
+
Usage
|
|
6
|
+
$ rclonefile <source> <destination>
|
|
7
|
+
|
|
8
|
+
Options
|
|
9
|
+
--no-follow, -f Don't follow the src file if it is a symbolic link
|
|
10
|
+
|
|
11
|
+
--no-owner-copy, -c Don't copy ownership information from the source when
|
|
12
|
+
run called with superuser privileges.
|
|
13
|
+
|
|
14
|
+
--clone-acl, -a Copy ACLs from the source file.
|
|
15
|
+
|
|
16
|
+
Examples
|
|
17
|
+
$ rclonefile super-mario.png super-clone.png
|
|
18
|
+
`, {
|
|
19
|
+
importMeta: import.meta,
|
|
20
|
+
flags: {
|
|
21
|
+
noFollow: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
alias: "f",
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
noOwnerCopy: {
|
|
27
|
+
type: "boolean",
|
|
28
|
+
alias: "c",
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
cloneAcl: {
|
|
32
|
+
type: "boolean",
|
|
33
|
+
alias: "a",
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const [source, target] = cli.input;
|
|
39
|
+
try {
|
|
40
|
+
if (!source) {
|
|
41
|
+
throw Error("Missing file operand");
|
|
42
|
+
}
|
|
43
|
+
if (!target) {
|
|
44
|
+
throw Error(`Missing destination file operand after '${source}'`);
|
|
45
|
+
}
|
|
46
|
+
await cloneFile(cli.input[0], cli.input[1], cli.flags);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error(`rclonefile: ${error.message}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rclonefile-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"rclonefile": "./lib/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"watch": "tsc -w"
|
|
11
|
+
},
|
|
12
|
+
"exports": "lib/index.js",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"meow": "^11.0.0",
|
|
16
|
+
"rclonefile": "^1.0.1",
|
|
17
|
+
"typescript": "^4.9.5"
|
|
18
|
+
}
|
|
19
|
+
}
|