@flowscripter/flowscripter-io-cli 1.1.1 → 1.2.1
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/bun.lock +61 -61
- package/package.json +12 -12
- package/src/cli.ts +6 -2
- package/src/commands/delete.ts +6 -1
- package/src/commands/get-properties.ts +12 -1
- package/src/commands/hash.ts +27 -7
- package/src/commands/list.ts +15 -1
- package/src/commands/set-properties.ts +6 -1
- package/tests/commands_test.ts +30 -1
- package/tests/testContext.ts +32 -4
package/bun.lock
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "@flowscripter/flowscripter-io-cli",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@flowscripter/dynamic-cli-framework": "^5.4.
|
|
9
|
-
"@flowscripter/dynamic-cli-framework-api": "^2.3.
|
|
10
|
-
"@flowscripter/dynamic-plugin-framework": "^2.2.
|
|
11
|
-
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.
|
|
12
|
-
"@flowscripter/pluggable-io-framework": "^1.1.
|
|
13
|
-
"@flowscripter/pluggable-io-framework-api": "^1.0.
|
|
8
|
+
"@flowscripter/dynamic-cli-framework": "^5.4.3",
|
|
9
|
+
"@flowscripter/dynamic-cli-framework-api": "^2.3.4",
|
|
10
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.5",
|
|
11
|
+
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.2",
|
|
12
|
+
"@flowscripter/pluggable-io-framework": "^1.1.4",
|
|
13
|
+
"@flowscripter/pluggable-io-framework-api": "^1.0.8",
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@flowscripter/io-plugin-filesystem": "^1.0.
|
|
17
|
-
"@types/bun": "^1.4.
|
|
18
|
-
"@types/node": "^26.4.
|
|
19
|
-
"oxfmt": "0.
|
|
20
|
-
"oxlint": "1.
|
|
16
|
+
"@flowscripter/io-plugin-filesystem": "^1.0.5",
|
|
17
|
+
"@types/bun": "^1.4.1",
|
|
18
|
+
"@types/node": "^26.4.1",
|
|
19
|
+
"oxfmt": "0.66.0",
|
|
20
|
+
"oxlint": "1.81.0",
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"typescript": "^7.0.2",
|
|
@@ -25,101 +25,101 @@
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
"packages": {
|
|
28
|
-
"@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@5.4.
|
|
28
|
+
"@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@5.4.3", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^2.3.4", "@flowscripter/dynamic-plugin-framework": "^2.2.5", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.11.4", "highlight.js": "^11.12.0", "prettier": "^3.9.6", "semver": "^7.8.5", "supports-color": "^11.0.0", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-eAOFJkHIKTHupUJXg+ooC+79AMkbPamsAykVGBeqIc+CbqvOvG4sOZ7YYNn0s9Bl9j9Bi0Z0e0py31Q8nBnXQA=="],
|
|
29
29
|
|
|
30
|
-
"@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@2.3.
|
|
30
|
+
"@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@2.3.4", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-IisiSF13BYxvnISWM4Y9OaKiTMulPJO/Q6Ahx1yzZdfnradCSwcZJVE3QeiMuP9mkiVF4/8LpJcn1DEm4UOqLA=="],
|
|
31
31
|
|
|
32
|
-
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.2.
|
|
32
|
+
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.2.5", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-ERH7Rqb9H5n2Klupf6V7Mo/Ae/CQXKwaqTJq+QQQLY+mlcHBJ2LfAY0Wgc/BRSHpCGXgYQcnRpi/fQ36v6RAMw=="],
|
|
33
33
|
|
|
34
|
-
"@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@1.0.
|
|
34
|
+
"@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@1.0.2", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-5OKAKwwopy/3WS5/MfVUAwyzCi3jOlh6rbb4OssB5M5Fp4Cl0KW7Rq5FBZIZtH9E/JVRSZhb5ideP6cRuVtxVQ=="],
|
|
35
35
|
|
|
36
|
-
"@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@1.0.
|
|
36
|
+
"@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@1.0.5", "", { "dependencies": { "@flowscripter/pluggable-io-framework-api": "^1.0.7", "zod": "^4.5.4" }, "peerDependencies": { "@flowscripter/dynamic-plugin-framework": "*", "typescript": "^7.0.2" } }, "sha512-TJypyr66DkVQoHx1c+AAioCh3pvWEQSPtAuWJFVAlj9YqW37BFNg914K6dcu95ssqsaoK9JmWud6JdBIwXeE7Q=="],
|
|
37
37
|
|
|
38
|
-
"@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@1.1.
|
|
38
|
+
"@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@1.1.4", "", { "dependencies": { "@flowscripter/dynamic-plugin-framework": "^2.2.5", "@flowscripter/pluggable-io-framework-api": "^1.0.8" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-WRSqUmWL4EY5sYFfyJDn4wJ8FzqdphbfR5MKmXYI+H4Wd24bV5ycL4v++9daU3zf+bnIxq64yvzu6XVvRKuSmg=="],
|
|
39
39
|
|
|
40
|
-
"@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@1.0.
|
|
40
|
+
"@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@1.0.8", "", { "dependencies": { "zod": "^4.5.4", "zod-to-json-schema": "^3.25.2" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-7Orem6KGWCjn+kLhdI0AiGBXrxaahModxdkzgkDPC33d6rU5AraNkJMfD1hYPbqp19ipy9y95xzV2amA2/13FQ=="],
|
|
41
41
|
|
|
42
|
-
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.
|
|
42
|
+
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.66.0", "", { "os": "android", "cpu": "arm" }, "sha512-2Me9eoptv6ERdEuI2P8AOlYdHHraXebJaM6SC0kc2Dfb+mLrep2db+fedBPKaYn673h/vBgvP4tkOdAbaudX6w=="],
|
|
43
43
|
|
|
44
|
-
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.
|
|
44
|
+
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.66.0", "", { "os": "android", "cpu": "arm64" }, "sha512-u7O+bSSF0HGsDKkQQxBqvLGVepu93RA+JKu+ONqvfh4sCnCEbj31wZj4iG5gk3XfRwrmYj0/8catkO2LcblQKQ=="],
|
|
45
45
|
|
|
46
|
-
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.
|
|
46
|
+
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.66.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-/ikyMIVjX/sdo7KtjxoEsSUosfPzveVhT9RWMx9yGqFDKFJ89JAEKuEeLBmurDjrkb4w8tOnAdSO3SBaplY3bw=="],
|
|
47
47
|
|
|
48
|
-
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.
|
|
48
|
+
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.66.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-q5xUsKeFqawa9NXa6ZGXWimFV19m8MogKPdTaSVDAAk2EQKBmBZRDeluwcl1p8ty/OFc9s9888OKEh3xfPVH0g=="],
|
|
49
49
|
|
|
50
|
-
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.
|
|
50
|
+
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.66.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-CR+x4VzMY0pRXLK/xFQ/RzsSFkP5t2Z2mef0QY6OP/rTRcMUoMLCOM62/3Fp/t0K+UDoBKxvMyeb6D0zPMjleA=="],
|
|
51
51
|
|
|
52
|
-
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.
|
|
52
|
+
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.66.0", "", { "os": "linux", "cpu": "arm" }, "sha512-ZEYmO/LbH9tTQCADILHGZE4GeOXOAj2VzedHkASNwjmwlwtutJCLpCJbIs37wRGTFgWRoEcD72jpMX+IBJUGjQ=="],
|
|
53
53
|
|
|
54
|
-
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.
|
|
54
|
+
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.66.0", "", { "os": "linux", "cpu": "arm" }, "sha512-hNtR9/oU0CeTkq7JnRkmBQwqe17v2ZaAMLC4VcN7IIOWeRyWDk0knSPWS9iiLmtbZ2RRBBtsG01jQgkZmKCJeQ=="],
|
|
55
55
|
|
|
56
|
-
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.
|
|
56
|
+
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.66.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-uwOVQ8i6I1LT/+eDzfsgrrcZp8Fn6NPVUPn8fF5gdFGekFf0PddF+LEuwsD0/pbNUcKZhDj2rQ5UpITh9gF4iQ=="],
|
|
57
57
|
|
|
58
|
-
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.
|
|
58
|
+
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.66.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-tTkF2Dmx4nGAjmBlZb+UtTGqR/EK4ZrW9qBfzte07a9XWqzoGGKzpFFlyNDhQe+Uwql94+ReCTeNbhOXscw1Dg=="],
|
|
59
59
|
|
|
60
|
-
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.
|
|
60
|
+
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.66.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-F3cKHUav4yXOHn6GFnwpBhSYsJOYKKf9eqO/9jlEuqPxNw9zb98E9ZFct79gcg8pibUGkbveEu9WDlmXJpDzKw=="],
|
|
61
61
|
|
|
62
|
-
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.
|
|
62
|
+
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.66.0", "", { "os": "linux", "cpu": "none" }, "sha512-K5fDaNZfDyQMYA/3qL21bqyN0X9T15LLwwbFPt2aHc94+ZG7bh0vZEsy2y7NlRnjjHFSwN+Hzg6ldJtbOriH4Q=="],
|
|
63
63
|
|
|
64
|
-
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.
|
|
64
|
+
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.66.0", "", { "os": "linux", "cpu": "none" }, "sha512-44Yc+I+qOmTElRcEhm5hUKIUJEQIOugymz4ua4tB0Wox7tGAfIbjzmXz/HDAtw1Ij6gmBwZlzh4hc9679RhWeA=="],
|
|
65
65
|
|
|
66
|
-
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.
|
|
66
|
+
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.66.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-1e29Eg9hEj2kRBB19M0seIehPbbXHCk35GvImjDvb79rjjYjXCRmtbUNHJcgoktZAMIzXrTbxDBKmTc1V4bg3A=="],
|
|
67
67
|
|
|
68
|
-
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.
|
|
68
|
+
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.66.0", "", { "os": "linux", "cpu": "x64" }, "sha512-vODY1UQo10gngn0+D4xHKU84F1Twm1LqrzV4SqPXvmQKSd87paehvZ6jqA5wKs6XQrlWul9clYMDVHcoW9CPMA=="],
|
|
69
69
|
|
|
70
|
-
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.
|
|
70
|
+
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.66.0", "", { "os": "linux", "cpu": "x64" }, "sha512-YDzXx2JsT4+HL4MdkVrYjO55NS5lUKNm8rLC4ZPou8+seu0v0jhecSh+ufoO6+xEa8gccEezMlI2WHJi4ApUgw=="],
|
|
71
71
|
|
|
72
|
-
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.
|
|
72
|
+
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.66.0", "", { "os": "none", "cpu": "arm64" }, "sha512-mJjUYd8lj0+j4JkYyEM+5qKBf1Rnrpgjn/SVYKJhicVDqLz566ooa7Fs8zflPqt+dnZDV7X054rVIQX6ZcQNlQ=="],
|
|
73
73
|
|
|
74
|
-
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.
|
|
74
|
+
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.66.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-soV+0vESv7e5ntCHWC61x4gg8OSak6IHHnWsZmHrJFlvMj2AK+kmldErCNkVkrvc1Ts2/++rJXn+IuAb2WMXhw=="],
|
|
75
75
|
|
|
76
|
-
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.
|
|
76
|
+
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.66.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-YCPi23uRIEYuIKTZohAkKbPFpujQ5QBuUM5iDv+UqbCmTPAkaFsxjsSuB8xlBpRT0G7eP/4HMF+cPDSqHtOD9A=="],
|
|
77
77
|
|
|
78
|
-
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.
|
|
78
|
+
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.66.0", "", { "os": "win32", "cpu": "x64" }, "sha512-bwTQcv/JVRPkOqQtMF0X7vpvpncDQiBcXHxZ9S2hR12Hlo8bvBdUR5x5XnxzDZ3kM0qoZw1rv7KaD66Ly+pFWA=="],
|
|
79
79
|
|
|
80
|
-
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.
|
|
80
|
+
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.81.0", "", { "os": "android", "cpu": "arm" }, "sha512-IcCRsXiedJoJopY6mpZUBEeVFsUrutmrG7dZ87zMuKJlhg70Ora9bBl1WcCxZQtyI10YpnVdEso5oCg7YcfSHw=="],
|
|
81
81
|
|
|
82
|
-
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.
|
|
82
|
+
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.81.0", "", { "os": "android", "cpu": "arm64" }, "sha512-GRrIPyTGVhx3L3h+0T5xT2A0jFAcdPv4+IfuXpGDLIdl6XeYhgg/zw72A5ILZoUgRqZuM8F1y+V/gfDriXSxzQ=="],
|
|
83
83
|
|
|
84
|
-
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.
|
|
84
|
+
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.81.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-qNQ9tXRgLuKbqSV1S2h9h4KPHjbovO7RRR2/enUOtHzTkFZ7B9X5zqqHJua8dRyc7dBy7Aoyq5pqTSLFVcAzGQ=="],
|
|
85
85
|
|
|
86
|
-
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.
|
|
86
|
+
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.81.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-q0QTm32jWga2Gv4j7IaVZN0jYMi9UV73sWVgFtDA4iIfqwMCLLZ3ve+9KwfYtsaKZSgQhmPaogeZWqDZpcY1Pw=="],
|
|
87
87
|
|
|
88
|
-
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.
|
|
88
|
+
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.81.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-/+8wVWDXEC7wHVAhOc59Fw/SkMc1arLkFD8iQCaSsmzenK1X4doFqquL9H1wrtGUzaiycVqkf/sSpcILK6W1UA=="],
|
|
89
89
|
|
|
90
|
-
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.
|
|
90
|
+
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.81.0", "", { "os": "linux", "cpu": "arm" }, "sha512-4xt422FEgioRq9hAL4Tq7fujGUWnc8z1BJ+Oi8RN8vB8axaP+sdK6a2xdlcQCCYnJg9QMuMFS0AucuIFx/EacA=="],
|
|
91
91
|
|
|
92
|
-
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.
|
|
92
|
+
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.81.0", "", { "os": "linux", "cpu": "arm" }, "sha512-u3vna8KdGplH4DRCW9K54D68fcMo7IxVrkCJWwXnIhwtBdnDnYrmzOUA/XjmBlPpcLsgw9Z5BNdY4za9+Dj+MQ=="],
|
|
93
93
|
|
|
94
|
-
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.
|
|
94
|
+
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.81.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-3j9k+gsYsE7nv71GWotXsqsa2l9/aJenD7dVHNt/CBvsb0SgRjSMnHFeP59IXUAl1wvVFhqGl2wJNMwWU3UBlA=="],
|
|
95
95
|
|
|
96
|
-
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.
|
|
96
|
+
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.81.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-k5iAp3dNxW0/uDCBY+WSm8jKB2szu7SkEQZdgRRpDXvuDd69vvDcqhB3A/pWCfCwXyenjNjFn9Td1fVoyAc+Yg=="],
|
|
97
97
|
|
|
98
|
-
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.
|
|
98
|
+
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.81.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-TFqLja3uYmVSte6nof9GWrex9Z8WgdZrNiLC6Te5rXGDqXB2y4j/26iFhwosXiAFqDhE9JJVuuCkDKLwptTn1g=="],
|
|
99
99
|
|
|
100
|
-
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.
|
|
100
|
+
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.81.0", "", { "os": "linux", "cpu": "none" }, "sha512-UEcySvGS0NOVo7h7n7CYyJL9+6gFAh7Zc/ToDXVScFvzHSTIxtzkMVU30rmQ6+nQ1LF+UdiRDdJajpDu+OylLg=="],
|
|
101
101
|
|
|
102
|
-
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.
|
|
102
|
+
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.81.0", "", { "os": "linux", "cpu": "none" }, "sha512-H+diDbhD00+wI1IRP8Kz88x/lat+DgtoBJzoTthS16xkTJGNaEkfb8gzmd1rzc/2uDQQMl7GNl+JFUacVeWxIA=="],
|
|
103
103
|
|
|
104
|
-
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.
|
|
104
|
+
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.81.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-8znJ/5TekjOKg1j1Acho4PJMdiAHLtlcXuWEiipOhAMV6rQcXdmDdXCbheyDczN6TjBwiNfjcP81k4AthrKRzw=="],
|
|
105
105
|
|
|
106
|
-
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.
|
|
106
|
+
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.81.0", "", { "os": "linux", "cpu": "x64" }, "sha512-Q2Wj70yFsvn5QjlmifFzbj4H+kJy53bwqc41o1fzoM7MpLV1NIbhg/LpWXRfC6KOkSAdUx1Wd8VJsdPmhp/HRA=="],
|
|
107
107
|
|
|
108
|
-
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.
|
|
108
|
+
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.81.0", "", { "os": "linux", "cpu": "x64" }, "sha512-cPInHp/ddEe5qkyK2IiyQ8Q3Mp2oLLEhhsGgTK2oZx4L6+llGam1H1yBvJZ7qHfOXj8N3hxBS8sj4tO+gtFlIg=="],
|
|
109
109
|
|
|
110
|
-
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.
|
|
110
|
+
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.81.0", "", { "os": "none", "cpu": "arm64" }, "sha512-0CQxSX4ajqm07AHBf5U33qQzXKdd7wtq/oTL/7vpY6RNNuxrRi8W4bqUV1Jyu/vj+9KmxQyDhxfeVX1nQL6kfg=="],
|
|
111
111
|
|
|
112
|
-
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.
|
|
112
|
+
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.81.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-l0hbeISm9673hVrrQU8j/p2M7YH9Ouoj7p7E/QM55NTrKVLP+P3PF8hLu+OY+x0VtGRW+ggiQKZqmdYps9H+TA=="],
|
|
113
113
|
|
|
114
|
-
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.
|
|
114
|
+
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.81.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-ksqPP5jbFXcYreEQ7zdJh06rJQBymCTyGRCdaXjfcf2aG4f8KxUWY5wcgYHmaTK+FJ4bPG5sUAdOX+6trnH1JA=="],
|
|
115
115
|
|
|
116
|
-
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.
|
|
116
|
+
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.81.0", "", { "os": "win32", "cpu": "x64" }, "sha512-IZuUCwGw9emG5JtCp+fYGB+Z4OWEoeEcM8R5BA1pYw63/ieYFVdcU2ylxTpHbVHSenZnsYE+ZZ20uHAJszQ4cA=="],
|
|
117
117
|
|
|
118
|
-
"@types/bun": ["@types/bun@1.4.
|
|
118
|
+
"@types/bun": ["@types/bun@1.4.1", "", { "dependencies": { "bun-types": "1.4.1" } }, "sha512-0AVGiTXGajf1rgKom3N+c5L7CBxuoyyv1i44M0nX4UDK0G/fnRAMiri93nHuVPIb429KKtAgj7HatVmmOjeQLA=="],
|
|
119
119
|
|
|
120
120
|
"@types/hast": ["@types/hast@3.0.5", "", { "dependencies": { "@types/unist": "*" } }, "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g=="],
|
|
121
121
|
|
|
122
|
-
"@types/node": ["@types/node@26.4.
|
|
122
|
+
"@types/node": ["@types/node@26.4.1", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-k97ENvZWtvA6yqz5/FS6a7duDgOPEeOQOc2iKS/nY6mX6qJUKtLnWzQS+Xj6tXweyj6ZcTAK2Qecetnvi9nCLA=="],
|
|
123
123
|
|
|
124
124
|
"@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
|
|
125
125
|
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
|
|
164
164
|
"@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
|
|
165
165
|
|
|
166
|
-
"bun-types": ["bun-types@1.4.
|
|
166
|
+
"bun-types": ["bun-types@1.4.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-loKuVrAFZKfEv+JvWkHRS9GW5IqLuLRjVXN9p+vZvBN86O5hf/pBZQ5hSoyipsrMmWObZBDvWnlmKvjKTM0PdA=="],
|
|
167
167
|
|
|
168
168
|
"chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
|
|
169
169
|
|
|
@@ -183,9 +183,9 @@
|
|
|
183
183
|
|
|
184
184
|
"lowlight": ["lowlight@3.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.0.0", "highlight.js": "~11.9.0" } }, "sha512-CEbNVoSikAxwDMDPjXlqlFYiZLkDJHwyGu/MfOsJnF3d7f3tds5J3z8s/l9TMXhzfsJCCJEAsD78842mwmg0PQ=="],
|
|
185
185
|
|
|
186
|
-
"oxfmt": ["oxfmt@0.
|
|
186
|
+
"oxfmt": ["oxfmt@0.66.0", "", { "dependencies": { "tinypool": "2.1.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.66.0", "@oxfmt/binding-android-arm64": "0.66.0", "@oxfmt/binding-darwin-arm64": "0.66.0", "@oxfmt/binding-darwin-x64": "0.66.0", "@oxfmt/binding-freebsd-x64": "0.66.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.66.0", "@oxfmt/binding-linux-arm-musleabihf": "0.66.0", "@oxfmt/binding-linux-arm64-gnu": "0.66.0", "@oxfmt/binding-linux-arm64-musl": "0.66.0", "@oxfmt/binding-linux-ppc64-gnu": "0.66.0", "@oxfmt/binding-linux-riscv64-gnu": "0.66.0", "@oxfmt/binding-linux-riscv64-musl": "0.66.0", "@oxfmt/binding-linux-s390x-gnu": "0.66.0", "@oxfmt/binding-linux-x64-gnu": "0.66.0", "@oxfmt/binding-linux-x64-musl": "0.66.0", "@oxfmt/binding-openharmony-arm64": "0.66.0", "@oxfmt/binding-win32-arm64-msvc": "0.66.0", "@oxfmt/binding-win32-ia32-msvc": "0.66.0", "@oxfmt/binding-win32-x64-msvc": "0.66.0" }, "peerDependencies": { "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-FfvqR8RFtV6JJpRrpkfqyVCQ7HDvZ/VriWFx7veftCgL1B5ZO9qNr+1rvPieycMQnNfVG0PWyJQiy7p0hq1I5w=="],
|
|
187
187
|
|
|
188
|
-
"oxlint": ["oxlint@1.
|
|
188
|
+
"oxlint": ["oxlint@1.81.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.81.0", "@oxlint/binding-android-arm64": "1.81.0", "@oxlint/binding-darwin-arm64": "1.81.0", "@oxlint/binding-darwin-x64": "1.81.0", "@oxlint/binding-freebsd-x64": "1.81.0", "@oxlint/binding-linux-arm-gnueabihf": "1.81.0", "@oxlint/binding-linux-arm-musleabihf": "1.81.0", "@oxlint/binding-linux-arm64-gnu": "1.81.0", "@oxlint/binding-linux-arm64-musl": "1.81.0", "@oxlint/binding-linux-ppc64-gnu": "1.81.0", "@oxlint/binding-linux-riscv64-gnu": "1.81.0", "@oxlint/binding-linux-riscv64-musl": "1.81.0", "@oxlint/binding-linux-s390x-gnu": "1.81.0", "@oxlint/binding-linux-x64-gnu": "1.81.0", "@oxlint/binding-linux-x64-musl": "1.81.0", "@oxlint/binding-openharmony-arm64": "1.81.0", "@oxlint/binding-win32-arm64-msvc": "1.81.0", "@oxlint/binding-win32-ia32-msvc": "1.81.0", "@oxlint/binding-win32-x64-msvc": "1.81.0" }, "peerDependencies": { "oxlint-tsgolint": ">=7.0.2001", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-HyrJYqeoOCL0iqaLEzGewGT48ZX99P3hxYh8udAF9RGGIghSamkXE4ClUyBpEDNqasamThgmlPbuMOe7SAZmHg=="],
|
|
189
189
|
|
|
190
190
|
"prettier": ["prettier@3.9.6", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g=="],
|
|
191
191
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/flowscripter-io-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Example CLI using https://github.com/flowscripter/pluggable-io-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@flowscripter/dynamic-cli-framework": "^5.4.
|
|
25
|
-
"@flowscripter/dynamic-cli-framework-api": "^2.3.
|
|
26
|
-
"@flowscripter/dynamic-plugin-framework": "^2.2.
|
|
27
|
-
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.
|
|
28
|
-
"@flowscripter/pluggable-io-framework": "^1.1.
|
|
29
|
-
"@flowscripter/pluggable-io-framework-api": "^1.0.
|
|
24
|
+
"@flowscripter/dynamic-cli-framework": "^5.4.3",
|
|
25
|
+
"@flowscripter/dynamic-cli-framework-api": "^2.3.4",
|
|
26
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.5",
|
|
27
|
+
"@flowscripter/flowscripter-io-cli-hash-native": "^1.0.2",
|
|
28
|
+
"@flowscripter/pluggable-io-framework": "^1.1.4",
|
|
29
|
+
"@flowscripter/pluggable-io-framework-api": "^1.0.8"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@flowscripter/io-plugin-filesystem": "^1.0.
|
|
33
|
-
"@types/bun": "^1.4.
|
|
34
|
-
"@types/node": "^26.4.
|
|
35
|
-
"oxfmt": "0.
|
|
36
|
-
"oxlint": "1.
|
|
32
|
+
"@flowscripter/io-plugin-filesystem": "^1.0.5",
|
|
33
|
+
"@types/bun": "^1.4.1",
|
|
34
|
+
"@types/node": "^26.4.1",
|
|
35
|
+
"oxfmt": "0.66.0",
|
|
36
|
+
"oxlint": "1.81.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"typescript": "^7.0.2"
|
package/src/cli.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
PrettyPrinterServiceProvider,
|
|
3
|
+
SyntaxHighlighterServiceProvider,
|
|
4
|
+
launchMultiCommandCLI,
|
|
5
|
+
} from "@flowscripter/dynamic-cli-framework";
|
|
2
6
|
import copy from "./commands/copy.ts";
|
|
3
7
|
import deleteCommand from "./commands/delete.ts";
|
|
4
8
|
import getProperties from "./commands/get-properties.ts";
|
|
@@ -18,7 +22,7 @@ export async function cli(): Promise<void> {
|
|
|
18
22
|
"Example CLI for pluggable-io-framework.",
|
|
19
23
|
"flowscripter-io-cli",
|
|
20
24
|
packageJson.version,
|
|
21
|
-
|
|
25
|
+
[new PrettyPrinterServiceProvider(40), new SyntaxHighlighterServiceProvider(35)],
|
|
22
26
|
{
|
|
23
27
|
pluginServiceEnabled: true,
|
|
24
28
|
pluginServiceRemoteConfig: {
|
package/src/commands/delete.ts
CHANGED
|
@@ -25,7 +25,12 @@ const deleteCommand: SubCommand = {
|
|
|
25
25
|
|
|
26
26
|
const provider = await getFilesystemProvider("");
|
|
27
27
|
try {
|
|
28
|
-
await
|
|
28
|
+
await printerService.showSpinner(`Deleting ${path}...`);
|
|
29
|
+
try {
|
|
30
|
+
await provider.delete(path);
|
|
31
|
+
} finally {
|
|
32
|
+
await printerService.hideSpinner();
|
|
33
|
+
}
|
|
29
34
|
await printerService.print(`Deleted ${path}\n`);
|
|
30
35
|
} finally {
|
|
31
36
|
await provider[Symbol.asyncDispose]();
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
PRETTY_PRINTER_SERVICE_ID,
|
|
2
3
|
PRINTER_SERVICE_ID,
|
|
4
|
+
SYNTAX_HIGHLIGHTER_SERVICE_ID,
|
|
3
5
|
type Context,
|
|
6
|
+
type PrettyPrinterService,
|
|
4
7
|
type PrinterService,
|
|
5
8
|
type SubCommand,
|
|
9
|
+
type SyntaxHighlighterService,
|
|
6
10
|
type Values,
|
|
7
11
|
ValueTypeName,
|
|
8
12
|
} from "@flowscripter/dynamic-cli-framework";
|
|
@@ -21,12 +25,19 @@ const getProperties: SubCommand = {
|
|
|
21
25
|
options: [],
|
|
22
26
|
async execute(context: Context, argumentValues: Values): Promise<void> {
|
|
23
27
|
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
28
|
+
const prettyPrinterService = context.getServiceById(
|
|
29
|
+
PRETTY_PRINTER_SERVICE_ID,
|
|
30
|
+
) as PrettyPrinterService;
|
|
31
|
+
const syntaxHighlighterService = context.getServiceById(
|
|
32
|
+
SYNTAX_HIGHLIGHTER_SERVICE_ID,
|
|
33
|
+
) as SyntaxHighlighterService;
|
|
24
34
|
const path = argumentValues.path as string;
|
|
25
35
|
|
|
26
36
|
const provider = await getFilesystemProvider("");
|
|
27
37
|
try {
|
|
28
38
|
const properties = await provider.getProperties(path);
|
|
29
|
-
await
|
|
39
|
+
const pretty = await prettyPrinterService.prettify(JSON.stringify(properties), "json");
|
|
40
|
+
await printerService.print(`${syntaxHighlighterService.highlight(pretty, "json")}\n`);
|
|
30
41
|
} finally {
|
|
31
42
|
await provider[Symbol.asyncDispose]();
|
|
32
43
|
}
|
package/src/commands/hash.ts
CHANGED
|
@@ -37,13 +37,28 @@ const hash: SubCommand = {
|
|
|
37
37
|
|
|
38
38
|
const provider = await getFilesystemProvider("");
|
|
39
39
|
try {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const { size } = await provider.getProperties(path);
|
|
41
|
+
const progressHandle = await printerService.showProgressBar(
|
|
42
|
+
"bytes",
|
|
43
|
+
`Hashing ${path}`,
|
|
44
|
+
size ?? 100,
|
|
45
|
+
);
|
|
46
|
+
let bytesProcessed = 0;
|
|
47
|
+
const onChunk = (chunkLength: number): void => {
|
|
48
|
+
bytesProcessed += chunkLength;
|
|
49
|
+
printerService.updateProgressBar(progressHandle, bytesProcessed);
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const handle = await provider.getReadableStream(path);
|
|
53
|
+
const reader = (handle.stream as ReadableStream<ChunkRef>).getReader();
|
|
54
|
+
const digestHex =
|
|
55
|
+
algorithm === "sha256"
|
|
56
|
+
? await hashWithNativeSha256(reader, onChunk)
|
|
57
|
+
: await hashWithBunCryptoHasher(reader, algorithm, onChunk);
|
|
58
|
+
await printerService.print(`${digestHex} ${path}\n`);
|
|
59
|
+
} finally {
|
|
60
|
+
await printerService.hideProgressBar(progressHandle);
|
|
61
|
+
}
|
|
47
62
|
} finally {
|
|
48
63
|
await provider[Symbol.asyncDispose]();
|
|
49
64
|
}
|
|
@@ -58,6 +73,7 @@ function toHex(bytes: Uint8Array): string {
|
|
|
58
73
|
|
|
59
74
|
async function hashWithNativeSha256(
|
|
60
75
|
reader: ReadableStreamDefaultReader<ChunkRef>,
|
|
76
|
+
onChunk: (chunkLength: number) => void,
|
|
61
77
|
): Promise<string> {
|
|
62
78
|
const hasher = new Sha256Hasher();
|
|
63
79
|
for (;;) {
|
|
@@ -65,8 +81,10 @@ async function hashWithNativeSha256(
|
|
|
65
81
|
if (done) break;
|
|
66
82
|
if (value.kind === ChunkKind.Js) {
|
|
67
83
|
hasher.update(value.data);
|
|
84
|
+
onChunk(value.data.byteLength);
|
|
68
85
|
} else {
|
|
69
86
|
hasher.updatePointer(value.ptr, value.length);
|
|
87
|
+
onChunk(value.length);
|
|
70
88
|
value.release();
|
|
71
89
|
}
|
|
72
90
|
}
|
|
@@ -76,6 +94,7 @@ async function hashWithNativeSha256(
|
|
|
76
94
|
async function hashWithBunCryptoHasher(
|
|
77
95
|
reader: ReadableStreamDefaultReader<ChunkRef>,
|
|
78
96
|
algorithm: string,
|
|
97
|
+
onChunk: (chunkLength: number) => void,
|
|
79
98
|
): Promise<string> {
|
|
80
99
|
const hasher = new Bun.CryptoHasher(
|
|
81
100
|
algorithm as ConstructorParameters<typeof Bun.CryptoHasher>[0],
|
|
@@ -85,6 +104,7 @@ async function hashWithBunCryptoHasher(
|
|
|
85
104
|
if (done) break;
|
|
86
105
|
if (value.kind === ChunkKind.Js) {
|
|
87
106
|
hasher.update(value.data);
|
|
107
|
+
onChunk(value.data.byteLength);
|
|
88
108
|
} else {
|
|
89
109
|
throw new Error(`hash command only supports js-kind chunks for algorithm "${algorithm}"`);
|
|
90
110
|
}
|
package/src/commands/list.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
PRETTY_PRINTER_SERVICE_ID,
|
|
2
3
|
PRINTER_SERVICE_ID,
|
|
4
|
+
SYNTAX_HIGHLIGHTER_SERVICE_ID,
|
|
3
5
|
type Context,
|
|
6
|
+
type PrettyPrinterService,
|
|
4
7
|
type PrinterService,
|
|
5
8
|
type SubCommand,
|
|
9
|
+
type SyntaxHighlighterService,
|
|
6
10
|
type Values,
|
|
7
11
|
ValueTypeName,
|
|
8
12
|
} from "@flowscripter/dynamic-cli-framework";
|
|
@@ -37,6 +41,12 @@ const list: SubCommand = {
|
|
|
37
41
|
],
|
|
38
42
|
async execute(context: Context, argumentValues: Values): Promise<void> {
|
|
39
43
|
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
44
|
+
const prettyPrinterService = context.getServiceById(
|
|
45
|
+
PRETTY_PRINTER_SERVICE_ID,
|
|
46
|
+
) as PrettyPrinterService;
|
|
47
|
+
const syntaxHighlighterService = context.getServiceById(
|
|
48
|
+
SYNTAX_HIGHLIGHTER_SERVICE_ID,
|
|
49
|
+
) as SyntaxHighlighterService;
|
|
40
50
|
const path = argumentValues.path as string;
|
|
41
51
|
const recursive = argumentValues.recursive as boolean | undefined;
|
|
42
52
|
const regex = argumentValues.regex as string | undefined;
|
|
@@ -47,7 +57,11 @@ const list: SubCommand = {
|
|
|
47
57
|
recursive,
|
|
48
58
|
regex: regex ? new RegExp(regex) : undefined,
|
|
49
59
|
})) {
|
|
50
|
-
|
|
60
|
+
const pretty = await prettyPrinterService.prettify(
|
|
61
|
+
JSON.stringify({ path: item.path, ...item.properties }),
|
|
62
|
+
"json",
|
|
63
|
+
);
|
|
64
|
+
await printerService.print(`${syntaxHighlighterService.highlight(pretty, "json")}\n`);
|
|
51
65
|
}
|
|
52
66
|
} finally {
|
|
53
67
|
await provider[Symbol.asyncDispose]();
|
|
@@ -34,7 +34,12 @@ const setProperties: SubCommand = {
|
|
|
34
34
|
|
|
35
35
|
const provider = await getFilesystemProvider("");
|
|
36
36
|
try {
|
|
37
|
-
await
|
|
37
|
+
await printerService.showSpinner(`Setting properties for ${path}...`);
|
|
38
|
+
try {
|
|
39
|
+
await provider.setProperties(path, mode !== undefined ? { mode } : {});
|
|
40
|
+
} finally {
|
|
41
|
+
await printerService.hideSpinner();
|
|
42
|
+
}
|
|
38
43
|
await printerService.print(`Updated properties for ${path}\n`);
|
|
39
44
|
} finally {
|
|
40
45
|
await provider[Symbol.asyncDispose]();
|
package/tests/commands_test.ts
CHANGED
|
@@ -55,13 +55,14 @@ describe("list", () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
describe("get-properties", () => {
|
|
58
|
-
test("prints properties as JSON", async () => {
|
|
58
|
+
test("prints properties as pretty-printed JSON", async () => {
|
|
59
59
|
await writeFile(join(root, "a.txt"), "hello");
|
|
60
60
|
const { lines, context } = createStubContext();
|
|
61
61
|
|
|
62
62
|
await getProperties.execute(context, { path: join(root, "a.txt") });
|
|
63
63
|
|
|
64
64
|
expect(JSON.parse(lines[0]!).size).toBe(5);
|
|
65
|
+
expect(lines[0]).toContain("\n");
|
|
65
66
|
});
|
|
66
67
|
});
|
|
67
68
|
|
|
@@ -79,6 +80,15 @@ describe("set-properties", () => {
|
|
|
79
80
|
expect(properties.properties.mode & 0o777).toBe(0o600);
|
|
80
81
|
}
|
|
81
82
|
});
|
|
83
|
+
|
|
84
|
+
test("shows a spinner while applying properties", async () => {
|
|
85
|
+
await writeFile(join(root, "a.txt"), "hello");
|
|
86
|
+
const { context, spinnerMessages } = createStubContext();
|
|
87
|
+
|
|
88
|
+
await setProperties.execute(context, { path: join(root, "a.txt"), mode: 0o600 });
|
|
89
|
+
|
|
90
|
+
expect(spinnerMessages).toEqual([`Setting properties for ${join(root, "a.txt")}...`]);
|
|
91
|
+
});
|
|
82
92
|
});
|
|
83
93
|
|
|
84
94
|
describe("delete", () => {
|
|
@@ -92,6 +102,15 @@ describe("delete", () => {
|
|
|
92
102
|
await list.execute(listContext, { path: root });
|
|
93
103
|
expect(lines.length).toBe(0);
|
|
94
104
|
});
|
|
105
|
+
|
|
106
|
+
test("shows a spinner while deleting", async () => {
|
|
107
|
+
await writeFile(join(root, "a.txt"), "hello");
|
|
108
|
+
const { context, spinnerMessages } = createStubContext();
|
|
109
|
+
|
|
110
|
+
await deleteCommand.execute(context, { path: join(root, "a.txt") });
|
|
111
|
+
|
|
112
|
+
expect(spinnerMessages).toEqual([`Deleting ${join(root, "a.txt")}...`]);
|
|
113
|
+
});
|
|
95
114
|
});
|
|
96
115
|
|
|
97
116
|
describe("copy", () => {
|
|
@@ -142,4 +161,14 @@ describe("hash", () => {
|
|
|
142
161
|
const expected = new Bun.CryptoHasher("sha1").update("hello").digest("hex");
|
|
143
162
|
expect(lines[0]).toBe(`${expected} ${join(root, "a.txt")}\n`);
|
|
144
163
|
});
|
|
164
|
+
|
|
165
|
+
test("reports progress as the file is read", async () => {
|
|
166
|
+
await writeFile(join(root, "a.txt"), "hello");
|
|
167
|
+
const { context, progressUpdates } = createStubContext();
|
|
168
|
+
|
|
169
|
+
await hash.execute(context, { path: join(root, "a.txt"), algorithm: "sha256" });
|
|
170
|
+
|
|
171
|
+
expect(progressUpdates.length).toBeGreaterThan(0);
|
|
172
|
+
expect(progressUpdates.at(-1)).toBe(5);
|
|
173
|
+
});
|
|
145
174
|
});
|
package/tests/testContext.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DefaultPrettyPrinterService,
|
|
3
|
+
DefaultSyntaxHighlighterService,
|
|
4
|
+
PRETTY_PRINTER_SERVICE_ID,
|
|
2
5
|
PRINTER_SERVICE_ID,
|
|
6
|
+
SYNTAX_HIGHLIGHTER_SERVICE_ID,
|
|
3
7
|
type Context,
|
|
4
8
|
type PrinterService,
|
|
5
9
|
} from "@flowscripter/dynamic-cli-framework";
|
|
6
10
|
|
|
7
11
|
export interface StubPrinter {
|
|
8
12
|
lines: string[];
|
|
13
|
+
spinnerMessages: string[];
|
|
14
|
+
progressUpdates: number[];
|
|
9
15
|
context: Context;
|
|
10
16
|
}
|
|
11
17
|
|
|
@@ -13,23 +19,45 @@ export interface StubPrinter {
|
|
|
13
19
|
* Minimal Context/PrinterService stub - only the PrinterService members our
|
|
14
20
|
* commands actually call are implemented; everything else would throw if
|
|
15
21
|
* invoked, which is intentional (a test relying on it should fail loudly).
|
|
22
|
+
*
|
|
23
|
+
* The pretty printer and syntax highlighter are the real default
|
|
24
|
+
* implementations (colorEnabled = false, so highlight() is a no-op) so
|
|
25
|
+
* `get-properties`/`list` output stays plain, JSON.parse-able text in tests.
|
|
16
26
|
*/
|
|
17
27
|
export function createStubContext(): StubPrinter {
|
|
18
28
|
const lines: string[] = [];
|
|
29
|
+
const spinnerMessages: string[] = [];
|
|
30
|
+
const progressUpdates: number[] = [];
|
|
19
31
|
const printerService = {
|
|
20
32
|
print: async (message: string) => {
|
|
21
33
|
lines.push(message);
|
|
22
34
|
},
|
|
23
35
|
showProgressBar: async () => 0,
|
|
24
|
-
updateProgressBar: () => {
|
|
36
|
+
updateProgressBar: (_handle: number, current: number) => {
|
|
37
|
+
progressUpdates.push(current);
|
|
38
|
+
},
|
|
25
39
|
hideProgressBar: async () => {},
|
|
40
|
+
showSpinner: async (message: string) => {
|
|
41
|
+
spinnerMessages.push(message);
|
|
42
|
+
},
|
|
43
|
+
hideSpinner: async () => {},
|
|
26
44
|
} as unknown as PrinterService;
|
|
27
45
|
|
|
46
|
+
const prettyPrinterService = new DefaultPrettyPrinterService();
|
|
47
|
+
const syntaxHighlighterService = new DefaultSyntaxHighlighterService();
|
|
48
|
+
syntaxHighlighterService.colorEnabled = false;
|
|
49
|
+
|
|
50
|
+
const services: Record<string, unknown> = {
|
|
51
|
+
[PRINTER_SERVICE_ID]: printerService,
|
|
52
|
+
[PRETTY_PRINTER_SERVICE_ID]: prettyPrinterService,
|
|
53
|
+
[SYNTAX_HIGHLIGHTER_SERVICE_ID]: syntaxHighlighterService,
|
|
54
|
+
};
|
|
55
|
+
|
|
28
56
|
const context: Context = {
|
|
29
57
|
cliConfig: { name: "test", version: "0.0.0" },
|
|
30
|
-
getServiceById: (id: string) =>
|
|
31
|
-
doesServiceExist: (id: string) => id
|
|
58
|
+
getServiceById: (id: string) => services[id],
|
|
59
|
+
doesServiceExist: (id: string) => id in services,
|
|
32
60
|
};
|
|
33
61
|
|
|
34
|
-
return { lines, context };
|
|
62
|
+
return { lines, spinnerMessages, progressUpdates, context };
|
|
35
63
|
}
|