@qodalis/cli-files 2.0.0-beta.12 → 2.0.0-beta.13
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/package.json +2 -2
- package/public-api.d.mts +4 -1
- package/public-api.d.ts +4 -1
- package/public-api.js +50 -44
- package/public-api.js.map +1 -1
- package/public-api.mjs +51 -45
- package/public-api.mjs.map +1 -1
- package/umd/index.global.js +32 -25
package/public-api.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ICliCompletionProvider_TOKEN, ICliFileTransferService_TOKEN, BrowserFileTransferService, DefaultLibraryAuthor, CliForegroundColor, ICliDragDropService_TOKEN } from '@qodalis/cli-core';
|
|
1
|
+
import { ICliCompletionProvider_TOKEN, ICliFileTransferService_TOKEN, BrowserFileTransferService, DefaultLibraryAuthor, CliForegroundColor, resolveHeaders, ICliDragDropService_TOKEN } from '@qodalis/cli-core';
|
|
2
2
|
|
|
3
3
|
// src/lib/interfaces/i-file-system-service.ts
|
|
4
4
|
var IFileSystemService_TOKEN = "cli-file-system-service";
|
|
5
5
|
|
|
6
6
|
// src/lib/version.ts
|
|
7
|
-
var LIBRARY_VERSION = "2.0.0-beta.
|
|
7
|
+
var LIBRARY_VERSION = "2.0.0-beta.13";
|
|
8
8
|
var API_VERSION = 2;
|
|
9
9
|
|
|
10
10
|
// src/lib/processors/cli-ls-command-processor.ts
|
|
@@ -34,7 +34,7 @@ var CliLsCommandProcessor = class {
|
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
36
|
async processCommand(command, context) {
|
|
37
|
-
const fs = context.services.
|
|
37
|
+
const fs = context.services.getRequired(
|
|
38
38
|
IFileSystemService_TOKEN
|
|
39
39
|
);
|
|
40
40
|
const targetPath = command.value || fs.getCurrentDirectory();
|
|
@@ -105,7 +105,7 @@ var CliCdCommandProcessor = class {
|
|
|
105
105
|
this.metadata = { icon: "\u{1F4C1}", module: "file management" };
|
|
106
106
|
}
|
|
107
107
|
async processCommand(command, context) {
|
|
108
|
-
const fs = context.services.
|
|
108
|
+
const fs = context.services.getRequired(
|
|
109
109
|
IFileSystemService_TOKEN
|
|
110
110
|
);
|
|
111
111
|
const target = command.value || "~";
|
|
@@ -126,7 +126,7 @@ var CliPwdCommandProcessor = class {
|
|
|
126
126
|
this.metadata = { icon: "\u{1F4C2}", module: "file management" };
|
|
127
127
|
}
|
|
128
128
|
async processCommand(command, context) {
|
|
129
|
-
const fs = context.services.
|
|
129
|
+
const fs = context.services.getRequired(
|
|
130
130
|
IFileSystemService_TOKEN
|
|
131
131
|
);
|
|
132
132
|
context.writer.writeln(fs.getCurrentDirectory());
|
|
@@ -152,7 +152,7 @@ var CliMkdirCommandProcessor = class {
|
|
|
152
152
|
];
|
|
153
153
|
}
|
|
154
154
|
async processCommand(command, context) {
|
|
155
|
-
const fs = context.services.
|
|
155
|
+
const fs = context.services.getRequired(
|
|
156
156
|
IFileSystemService_TOKEN
|
|
157
157
|
);
|
|
158
158
|
const path = command.value;
|
|
@@ -180,7 +180,7 @@ var CliRmdirCommandProcessor = class {
|
|
|
180
180
|
this.metadata = { icon: "\u{1F5D1}", module: "file management" };
|
|
181
181
|
}
|
|
182
182
|
async processCommand(command, context) {
|
|
183
|
-
const fs = context.services.
|
|
183
|
+
const fs = context.services.getRequired(
|
|
184
184
|
IFileSystemService_TOKEN
|
|
185
185
|
);
|
|
186
186
|
const path = command.value;
|
|
@@ -224,7 +224,7 @@ var CliTouchCommandProcessor = class {
|
|
|
224
224
|
this.metadata = { icon: "\u{1F4C4}", module: "file management" };
|
|
225
225
|
}
|
|
226
226
|
async processCommand(command, context) {
|
|
227
|
-
const fs = context.services.
|
|
227
|
+
const fs = context.services.getRequired(
|
|
228
228
|
IFileSystemService_TOKEN
|
|
229
229
|
);
|
|
230
230
|
const path = command.value;
|
|
@@ -251,7 +251,7 @@ var CliCatCommandProcessor = class {
|
|
|
251
251
|
this.metadata = { icon: "\u{1F4D6}", module: "file management" };
|
|
252
252
|
}
|
|
253
253
|
async processCommand(command, context) {
|
|
254
|
-
const fs = context.services.
|
|
254
|
+
const fs = context.services.getRequired(
|
|
255
255
|
IFileSystemService_TOKEN
|
|
256
256
|
);
|
|
257
257
|
const path = command.value;
|
|
@@ -290,7 +290,7 @@ var CliEchoCommandProcessor = class {
|
|
|
290
290
|
}
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
|
-
const fs = context.services.
|
|
293
|
+
const fs = context.services.getRequired(
|
|
294
294
|
IFileSystemService_TOKEN
|
|
295
295
|
);
|
|
296
296
|
let text;
|
|
@@ -362,7 +362,7 @@ var CliRmCommandProcessor = class {
|
|
|
362
362
|
];
|
|
363
363
|
}
|
|
364
364
|
async processCommand(command, context) {
|
|
365
|
-
const fs = context.services.
|
|
365
|
+
const fs = context.services.getRequired(
|
|
366
366
|
IFileSystemService_TOKEN
|
|
367
367
|
);
|
|
368
368
|
const path = command.value;
|
|
@@ -411,7 +411,7 @@ var CliCpCommandProcessor = class {
|
|
|
411
411
|
];
|
|
412
412
|
}
|
|
413
413
|
async processCommand(command, context) {
|
|
414
|
-
const fs = context.services.
|
|
414
|
+
const fs = context.services.getRequired(
|
|
415
415
|
IFileSystemService_TOKEN
|
|
416
416
|
);
|
|
417
417
|
const recursive = command.args["recursive"] || command.args["r"] || command.args["R"];
|
|
@@ -447,7 +447,7 @@ var CliMvCommandProcessor = class {
|
|
|
447
447
|
this.metadata = { icon: "\u{1F4E6}", module: "file management" };
|
|
448
448
|
}
|
|
449
449
|
async processCommand(command, context) {
|
|
450
|
-
const fs = context.services.
|
|
450
|
+
const fs = context.services.getRequired(
|
|
451
451
|
IFileSystemService_TOKEN
|
|
452
452
|
);
|
|
453
453
|
const parts = this.parseArgs(command);
|
|
@@ -489,7 +489,7 @@ var CliTreeCommandProcessor = class {
|
|
|
489
489
|
];
|
|
490
490
|
}
|
|
491
491
|
async processCommand(command, context) {
|
|
492
|
-
const fs = context.services.
|
|
492
|
+
const fs = context.services.getRequired(
|
|
493
493
|
IFileSystemService_TOKEN
|
|
494
494
|
);
|
|
495
495
|
const targetPath = command.value || fs.getCurrentDirectory();
|
|
@@ -582,7 +582,7 @@ var CliHeadCommandProcessor = class {
|
|
|
582
582
|
];
|
|
583
583
|
}
|
|
584
584
|
async processCommand(command, context) {
|
|
585
|
-
const fs = context.services.
|
|
585
|
+
const fs = context.services.getRequired(
|
|
586
586
|
IFileSystemService_TOKEN
|
|
587
587
|
);
|
|
588
588
|
const count = parseInt(
|
|
@@ -647,7 +647,7 @@ var CliTailCommandProcessor = class {
|
|
|
647
647
|
];
|
|
648
648
|
}
|
|
649
649
|
async processCommand(command, context) {
|
|
650
|
-
const fs = context.services.
|
|
650
|
+
const fs = context.services.getRequired(
|
|
651
651
|
IFileSystemService_TOKEN
|
|
652
652
|
);
|
|
653
653
|
const count = parseInt(
|
|
@@ -726,7 +726,7 @@ var CliWcCommandProcessor = class {
|
|
|
726
726
|
];
|
|
727
727
|
}
|
|
728
728
|
async processCommand(command, context) {
|
|
729
|
-
const fs = context.services.
|
|
729
|
+
const fs = context.services.getRequired(
|
|
730
730
|
IFileSystemService_TOKEN
|
|
731
731
|
);
|
|
732
732
|
const showLines = command.args["lines"] || command.args["l"] || false;
|
|
@@ -820,7 +820,7 @@ var CliFindCommandProcessor = class {
|
|
|
820
820
|
];
|
|
821
821
|
}
|
|
822
822
|
async processCommand(command, context) {
|
|
823
|
-
const fs = context.services.
|
|
823
|
+
const fs = context.services.getRequired(
|
|
824
824
|
IFileSystemService_TOKEN
|
|
825
825
|
);
|
|
826
826
|
const searchPath = this.parseSearchPath(command) || fs.getCurrentDirectory();
|
|
@@ -955,7 +955,7 @@ var CliGrepCommandProcessor = class {
|
|
|
955
955
|
];
|
|
956
956
|
}
|
|
957
957
|
async processCommand(command, context) {
|
|
958
|
-
const fs = context.services.
|
|
958
|
+
const fs = context.services.getRequired(
|
|
959
959
|
IFileSystemService_TOKEN
|
|
960
960
|
);
|
|
961
961
|
const ignoreCase = command.args["ignore-case"] || command.args["i"] || false;
|
|
@@ -1125,7 +1125,7 @@ var CliTacCommandProcessor = class {
|
|
|
1125
1125
|
this.metadata = { icon: "\u{1F504}", module: "file management" };
|
|
1126
1126
|
}
|
|
1127
1127
|
async processCommand(command, context) {
|
|
1128
|
-
const fs = context.services.
|
|
1128
|
+
const fs = context.services.getRequired(
|
|
1129
1129
|
IFileSystemService_TOKEN
|
|
1130
1130
|
);
|
|
1131
1131
|
const paths = this.parsePaths(command);
|
|
@@ -1297,7 +1297,7 @@ var CliSortCommandProcessor = class {
|
|
|
1297
1297
|
];
|
|
1298
1298
|
}
|
|
1299
1299
|
async processCommand(command, context) {
|
|
1300
|
-
const fs = context.services.
|
|
1300
|
+
const fs = context.services.getRequired(
|
|
1301
1301
|
IFileSystemService_TOKEN
|
|
1302
1302
|
);
|
|
1303
1303
|
const reverse = !!command.args["r"] || !!command.args["reverse"];
|
|
@@ -1450,7 +1450,7 @@ var CliUniqCommandProcessor = class {
|
|
|
1450
1450
|
];
|
|
1451
1451
|
}
|
|
1452
1452
|
async processCommand(command, context) {
|
|
1453
|
-
const fs = context.services.
|
|
1453
|
+
const fs = context.services.getRequired(
|
|
1454
1454
|
IFileSystemService_TOKEN
|
|
1455
1455
|
);
|
|
1456
1456
|
const showCount = !!command.args["c"] || !!command.args["count"];
|
|
@@ -1581,7 +1581,7 @@ var CliCutCommandProcessor = class {
|
|
|
1581
1581
|
];
|
|
1582
1582
|
}
|
|
1583
1583
|
async processCommand(command, context) {
|
|
1584
|
-
const fs = context.services.
|
|
1584
|
+
const fs = context.services.getRequired(
|
|
1585
1585
|
IFileSystemService_TOKEN
|
|
1586
1586
|
);
|
|
1587
1587
|
const delimiter = command.args["d"] || command.args["delimiter"] || " ";
|
|
@@ -1731,7 +1731,7 @@ var CliPasteCommandProcessor = class {
|
|
|
1731
1731
|
];
|
|
1732
1732
|
}
|
|
1733
1733
|
async processCommand(command, context) {
|
|
1734
|
-
const fs = context.services.
|
|
1734
|
+
const fs = context.services.getRequired(
|
|
1735
1735
|
IFileSystemService_TOKEN
|
|
1736
1736
|
);
|
|
1737
1737
|
const delimiter = command.args["d"] || command.args["delimiters"] || " ";
|
|
@@ -1898,7 +1898,7 @@ var CliTrCommandProcessor = class {
|
|
|
1898
1898
|
];
|
|
1899
1899
|
}
|
|
1900
1900
|
async processCommand(command, context) {
|
|
1901
|
-
const fs = context.services.
|
|
1901
|
+
const fs = context.services.getRequired(
|
|
1902
1902
|
IFileSystemService_TOKEN
|
|
1903
1903
|
);
|
|
1904
1904
|
const raw = command.value || "";
|
|
@@ -2053,7 +2053,7 @@ var CliStatCommandProcessor = class {
|
|
|
2053
2053
|
this.parameters = [];
|
|
2054
2054
|
}
|
|
2055
2055
|
async processCommand(command, context) {
|
|
2056
|
-
const fs = context.services.
|
|
2056
|
+
const fs = context.services.getRequired(
|
|
2057
2057
|
IFileSystemService_TOKEN
|
|
2058
2058
|
);
|
|
2059
2059
|
const paths = this.parsePaths(command);
|
|
@@ -2106,7 +2106,7 @@ var CliChmodCommandProcessor = class {
|
|
|
2106
2106
|
];
|
|
2107
2107
|
}
|
|
2108
2108
|
async processCommand(command, context) {
|
|
2109
|
-
const fs = context.services.
|
|
2109
|
+
const fs = context.services.getRequired(
|
|
2110
2110
|
IFileSystemService_TOKEN
|
|
2111
2111
|
);
|
|
2112
2112
|
const { recursive, mode, paths } = this.parseArgs(command);
|
|
@@ -2226,7 +2226,7 @@ var CliChownCommandProcessor = class {
|
|
|
2226
2226
|
];
|
|
2227
2227
|
}
|
|
2228
2228
|
async processCommand(command, context) {
|
|
2229
|
-
const fs = context.services.
|
|
2229
|
+
const fs = context.services.getRequired(
|
|
2230
2230
|
IFileSystemService_TOKEN
|
|
2231
2231
|
);
|
|
2232
2232
|
const { recursive, ownerSpec, paths } = this.parseArgs(command);
|
|
@@ -2321,7 +2321,7 @@ var CliDuCommandProcessor = class {
|
|
|
2321
2321
|
];
|
|
2322
2322
|
}
|
|
2323
2323
|
async processCommand(command, context) {
|
|
2324
|
-
const fs = context.services.
|
|
2324
|
+
const fs = context.services.getRequired(
|
|
2325
2325
|
IFileSystemService_TOKEN
|
|
2326
2326
|
);
|
|
2327
2327
|
const { humanReadable, summaryOnly, maxDepth, paths } = this.parseArgs(command);
|
|
@@ -2418,7 +2418,7 @@ var CliLnCommandProcessor = class {
|
|
|
2418
2418
|
];
|
|
2419
2419
|
}
|
|
2420
2420
|
async processCommand(command, context) {
|
|
2421
|
-
const fs = context.services.
|
|
2421
|
+
const fs = context.services.getRequired(
|
|
2422
2422
|
IFileSystemService_TOKEN
|
|
2423
2423
|
);
|
|
2424
2424
|
const { symbolic, target, linkName } = this.parseArgs(command);
|
|
@@ -2492,7 +2492,7 @@ var CliSedCommandProcessor = class {
|
|
|
2492
2492
|
];
|
|
2493
2493
|
}
|
|
2494
2494
|
async processCommand(command, context) {
|
|
2495
|
-
const fs = context.services.
|
|
2495
|
+
const fs = context.services.getRequired(
|
|
2496
2496
|
IFileSystemService_TOKEN
|
|
2497
2497
|
);
|
|
2498
2498
|
const { inPlace, suppress, expressions, filePath } = this.parseRawCommand(command);
|
|
@@ -2835,7 +2835,7 @@ var CliAwkCommandProcessor = class {
|
|
|
2835
2835
|
];
|
|
2836
2836
|
}
|
|
2837
2837
|
async processCommand(command, context) {
|
|
2838
|
-
const fs = context.services.
|
|
2838
|
+
const fs = context.services.getRequired(
|
|
2839
2839
|
IFileSystemService_TOKEN
|
|
2840
2840
|
);
|
|
2841
2841
|
const { program, filePath, fieldSep } = this.parseArgs(command);
|
|
@@ -3311,7 +3311,7 @@ var CliDiffCommandProcessor = class {
|
|
|
3311
3311
|
];
|
|
3312
3312
|
}
|
|
3313
3313
|
async processCommand(command, context) {
|
|
3314
|
-
const fs = context.services.
|
|
3314
|
+
const fs = context.services.getRequired(
|
|
3315
3315
|
IFileSystemService_TOKEN
|
|
3316
3316
|
);
|
|
3317
3317
|
const unified = command.args["unified"] || command.args["u"] || false;
|
|
@@ -3497,7 +3497,7 @@ var CliTeeCommandProcessor = class {
|
|
|
3497
3497
|
];
|
|
3498
3498
|
}
|
|
3499
3499
|
async processCommand(command, context) {
|
|
3500
|
-
const fs = context.services.
|
|
3500
|
+
const fs = context.services.getRequired(
|
|
3501
3501
|
IFileSystemService_TOKEN
|
|
3502
3502
|
);
|
|
3503
3503
|
const append = command.args["append"] || command.args["a"] || false;
|
|
@@ -3591,7 +3591,7 @@ var CliXargsCommandProcessor = class {
|
|
|
3591
3591
|
];
|
|
3592
3592
|
}
|
|
3593
3593
|
async processCommand(command, context) {
|
|
3594
|
-
const fs = context.services.
|
|
3594
|
+
const fs = context.services.getRequired(
|
|
3595
3595
|
IFileSystemService_TOKEN
|
|
3596
3596
|
);
|
|
3597
3597
|
const replaceStr = command.args["replace"] || command.args["I"] || null;
|
|
@@ -3704,7 +3704,7 @@ var CliShCommandProcessor = class {
|
|
|
3704
3704
|
];
|
|
3705
3705
|
}
|
|
3706
3706
|
async processCommand(command, context) {
|
|
3707
|
-
const fs = context.services.
|
|
3707
|
+
const fs = context.services.getRequired(
|
|
3708
3708
|
IFileSystemService_TOKEN
|
|
3709
3709
|
);
|
|
3710
3710
|
let filePath = (command.value || "").trim();
|
|
@@ -4330,8 +4330,6 @@ var IndexedDbFileSystemService = class {
|
|
|
4330
4330
|
});
|
|
4331
4331
|
}
|
|
4332
4332
|
};
|
|
4333
|
-
|
|
4334
|
-
// src/lib/services/server-file-system.service.ts
|
|
4335
4333
|
var DEFAULT_HOME2 = "/home/user";
|
|
4336
4334
|
function createSeedFileSystem2() {
|
|
4337
4335
|
const now = Date.now();
|
|
@@ -4381,6 +4379,7 @@ var ServerFileSystemService = class {
|
|
|
4381
4379
|
this.currentUid = null;
|
|
4382
4380
|
this.currentGroups = [];
|
|
4383
4381
|
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
4382
|
+
this.headersProvider = options.headers;
|
|
4384
4383
|
}
|
|
4385
4384
|
// --- User context ---
|
|
4386
4385
|
setCurrentUser(uid, groups) {
|
|
@@ -4788,7 +4787,14 @@ var ServerFileSystemService = class {
|
|
|
4788
4787
|
// --- Private: server communication ---
|
|
4789
4788
|
async serverFetch(endpoint, options) {
|
|
4790
4789
|
const url = `${this.baseUrl}/api/qcli/fs${endpoint}`;
|
|
4791
|
-
const
|
|
4790
|
+
const mergedHeaders = {
|
|
4791
|
+
...resolveHeaders(this.headersProvider),
|
|
4792
|
+
...options?.headers ?? {}
|
|
4793
|
+
};
|
|
4794
|
+
const response = await fetch(url, {
|
|
4795
|
+
...options,
|
|
4796
|
+
headers: mergedHeaders
|
|
4797
|
+
});
|
|
4792
4798
|
if (!response.ok) {
|
|
4793
4799
|
const body = await response.text();
|
|
4794
4800
|
throw new Error(
|
|
@@ -5057,10 +5063,10 @@ var CliUploadCommandProcessor = class {
|
|
|
5057
5063
|
];
|
|
5058
5064
|
}
|
|
5059
5065
|
async processCommand(command, context) {
|
|
5060
|
-
const fs = context.services.
|
|
5066
|
+
const fs = context.services.getRequired(
|
|
5061
5067
|
IFileSystemService_TOKEN
|
|
5062
5068
|
);
|
|
5063
|
-
const fileService = context.services.
|
|
5069
|
+
const fileService = context.services.getRequired(
|
|
5064
5070
|
ICliFileTransferService_TOKEN
|
|
5065
5071
|
);
|
|
5066
5072
|
if (!fileService) {
|
|
@@ -5070,7 +5076,7 @@ var CliUploadCommandProcessor = class {
|
|
|
5070
5076
|
const accept = command.args?.["accept"];
|
|
5071
5077
|
const destPath = command.value?.trim() || void 0;
|
|
5072
5078
|
context.spinner?.show("Waiting for file selection...");
|
|
5073
|
-
context.
|
|
5079
|
+
context.notifier.info("Waiting for file selection");
|
|
5074
5080
|
const picked = await fileService.uploadFromBrowser(accept);
|
|
5075
5081
|
if (!picked) {
|
|
5076
5082
|
context.spinner?.hide();
|
|
@@ -5083,7 +5089,7 @@ var CliUploadCommandProcessor = class {
|
|
|
5083
5089
|
filename.startsWith("/") ? filename : cwd + "/" + filename
|
|
5084
5090
|
);
|
|
5085
5091
|
context.spinner?.show(`Saving "${picked.name}" (${picked.content.length} bytes)...`);
|
|
5086
|
-
context.
|
|
5092
|
+
context.notifier.info(`Saving ${picked.name}`);
|
|
5087
5093
|
try {
|
|
5088
5094
|
fs.writeFile(resolved, picked.content);
|
|
5089
5095
|
await fs.persist();
|
|
@@ -5182,7 +5188,7 @@ var filesModule = {
|
|
|
5182
5188
|
return { ...this, config };
|
|
5183
5189
|
},
|
|
5184
5190
|
async onInit(context) {
|
|
5185
|
-
const fs = context.services.
|
|
5191
|
+
const fs = context.services.getRequired(
|
|
5186
5192
|
IFileSystemService_TOKEN
|
|
5187
5193
|
);
|
|
5188
5194
|
await fs.initialize();
|
|
@@ -5193,7 +5199,7 @@ var filesModule = {
|
|
|
5193
5199
|
}
|
|
5194
5200
|
let dragDrop;
|
|
5195
5201
|
try {
|
|
5196
|
-
dragDrop = context.services.
|
|
5202
|
+
dragDrop = context.services.getRequired(ICliDragDropService_TOKEN);
|
|
5197
5203
|
} catch {
|
|
5198
5204
|
}
|
|
5199
5205
|
if (dragDrop) {
|