@qodalis/cli-scp 2.0.0-beta.7 → 2.0.0-beta.8
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 +5 -1
- package/public-api.d.ts +5 -1
- package/public-api.js +60 -24
- package/public-api.js.map +1 -1
- package/public-api.mjs +60 -24
- package/public-api.mjs.map +1 -1
- package/umd/index.global.js +60 -24
package/umd/index.global.js
CHANGED
|
@@ -2680,7 +2680,7 @@ var scp = (() => {
|
|
|
2680
2680
|
};
|
|
2681
2681
|
|
|
2682
2682
|
// src/lib/version.ts
|
|
2683
|
-
var LIBRARY_VERSION = "2.0.0-beta.
|
|
2683
|
+
var LIBRARY_VERSION = "2.0.0-beta.8";
|
|
2684
2684
|
var API_VERSION = 2;
|
|
2685
2685
|
|
|
2686
2686
|
// src/lib/interfaces/index.ts
|
|
@@ -3012,7 +3012,7 @@ var scp = (() => {
|
|
|
3012
3012
|
constructor() {
|
|
3013
3013
|
this.command = "upload";
|
|
3014
3014
|
this.aliases = ["put"];
|
|
3015
|
-
this.description = "Upload a
|
|
3015
|
+
this.description = "Upload a file to a remote server (use --local to pick from your machine)";
|
|
3016
3016
|
this.acceptsRawInput = true;
|
|
3017
3017
|
this.valueRequired = true;
|
|
3018
3018
|
this.parameters = [
|
|
@@ -3024,8 +3024,8 @@ var scp = (() => {
|
|
|
3024
3024
|
},
|
|
3025
3025
|
{
|
|
3026
3026
|
name: "local-path",
|
|
3027
|
-
description: "Local file path",
|
|
3028
|
-
required:
|
|
3027
|
+
description: "Local file path (from virtual filesystem)",
|
|
3028
|
+
required: false,
|
|
3029
3029
|
type: "string"
|
|
3030
3030
|
},
|
|
3031
3031
|
{
|
|
@@ -3033,35 +3033,55 @@ var scp = (() => {
|
|
|
3033
3033
|
description: "Remote destination path",
|
|
3034
3034
|
required: true,
|
|
3035
3035
|
type: "string"
|
|
3036
|
+
},
|
|
3037
|
+
{
|
|
3038
|
+
name: "local",
|
|
3039
|
+
description: "Pick a file from your local machine via browser file picker",
|
|
3040
|
+
required: false,
|
|
3041
|
+
type: "boolean"
|
|
3036
3042
|
}
|
|
3037
3043
|
];
|
|
3038
3044
|
}
|
|
3039
3045
|
async processCommand(command, context) {
|
|
3040
3046
|
const args = command.args || {};
|
|
3047
|
+
const useLocalPicker = !!args["local"];
|
|
3041
3048
|
let serverName;
|
|
3042
3049
|
let localPath;
|
|
3043
3050
|
let remotePath;
|
|
3044
|
-
if (args["server"] && args["
|
|
3051
|
+
if (args["server"] && args["remote-path"]) {
|
|
3045
3052
|
serverName = String(args["server"]);
|
|
3046
|
-
localPath = String(args["local-path"]);
|
|
3053
|
+
localPath = args["local-path"] ? String(args["local-path"]) : void 0;
|
|
3047
3054
|
remotePath = String(args["remote-path"]);
|
|
3048
3055
|
} else {
|
|
3049
3056
|
const value = command.value?.trim();
|
|
3050
3057
|
if (!value) {
|
|
3051
|
-
context.writer.writeError(
|
|
3058
|
+
context.writer.writeError(
|
|
3059
|
+
useLocalPicker ? "Usage: scp upload --local <server> <remote-path>" : "Usage: scp upload <server> <local-path> <remote-path>"
|
|
3060
|
+
);
|
|
3052
3061
|
return;
|
|
3053
3062
|
}
|
|
3054
3063
|
const parts = value.split(/\s+/);
|
|
3055
|
-
if (
|
|
3056
|
-
|
|
3057
|
-
|
|
3064
|
+
if (useLocalPicker) {
|
|
3065
|
+
if (parts.length < 2) {
|
|
3066
|
+
context.writer.writeError("Usage: scp upload --local <server> <remote-path>");
|
|
3067
|
+
return;
|
|
3068
|
+
}
|
|
3069
|
+
serverName = parts[0];
|
|
3070
|
+
remotePath = parts[1];
|
|
3071
|
+
} else {
|
|
3072
|
+
if (parts.length < 3) {
|
|
3073
|
+
context.writer.writeError("Usage: scp upload <server> <local-path> <remote-path>");
|
|
3074
|
+
return;
|
|
3075
|
+
}
|
|
3076
|
+
serverName = parts[0];
|
|
3077
|
+
localPath = parts[1];
|
|
3078
|
+
remotePath = parts[2];
|
|
3058
3079
|
}
|
|
3059
|
-
serverName = parts[0];
|
|
3060
|
-
localPath = parts[1];
|
|
3061
|
-
remotePath = parts[2];
|
|
3062
3080
|
}
|
|
3063
|
-
if (!serverName || !localPath || !remotePath) {
|
|
3064
|
-
context.writer.writeError(
|
|
3081
|
+
if (!serverName || !useLocalPicker && !localPath || !remotePath) {
|
|
3082
|
+
context.writer.writeError(
|
|
3083
|
+
useLocalPicker ? "Usage: scp upload --local <server> <remote-path>" : "Usage: scp upload <server> <local-path> <remote-path>"
|
|
3084
|
+
);
|
|
3065
3085
|
return;
|
|
3066
3086
|
}
|
|
3067
3087
|
const server = resolveServer(serverName, context);
|
|
@@ -3080,18 +3100,30 @@ var scp = (() => {
|
|
|
3080
3100
|
context.writer.writeError("SCP transfer service not available.");
|
|
3081
3101
|
return;
|
|
3082
3102
|
}
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3103
|
+
let content;
|
|
3104
|
+
let filename;
|
|
3105
|
+
if (useLocalPicker) {
|
|
3106
|
+
const picked = await fileService.uploadFromBrowser();
|
|
3107
|
+
if (!picked) {
|
|
3108
|
+
context.writer.writeln("Upload cancelled.");
|
|
3109
|
+
return;
|
|
3110
|
+
}
|
|
3111
|
+
content = picked.content;
|
|
3112
|
+
filename = picked.name;
|
|
3113
|
+
} else {
|
|
3114
|
+
context.spinner?.show(`Reading local file "${localPath}"...`);
|
|
3115
|
+
content = await fileService.readFile(localPath);
|
|
3086
3116
|
if (content === null) {
|
|
3087
3117
|
context.spinner?.hide();
|
|
3088
3118
|
context.writer.writeError(`Local file not found: ${localPath}`);
|
|
3089
3119
|
return;
|
|
3090
3120
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
)
|
|
3121
|
+
filename = localPath.split("/").pop() || "file";
|
|
3122
|
+
}
|
|
3123
|
+
context.spinner?.show(
|
|
3124
|
+
`Uploading "${filename}" (${formatBytes(content.length)}) to ${server.name}:${remotePath}...`
|
|
3125
|
+
);
|
|
3126
|
+
try {
|
|
3095
3127
|
await transferService.upload(
|
|
3096
3128
|
serverUrl(server),
|
|
3097
3129
|
remotePath,
|
|
@@ -3109,8 +3141,11 @@ var scp = (() => {
|
|
|
3109
3141
|
}
|
|
3110
3142
|
}
|
|
3111
3143
|
writeDescription(context) {
|
|
3112
|
-
context.writer.writeln("Upload a
|
|
3113
|
-
context.writer.writeln("
|
|
3144
|
+
context.writer.writeln("Upload a file to a remote server.");
|
|
3145
|
+
context.writer.writeln("");
|
|
3146
|
+
context.writer.writeln("Usage:");
|
|
3147
|
+
context.writer.writeln(" scp upload <server> <local-path> <remote-path> Upload from virtual filesystem");
|
|
3148
|
+
context.writer.writeln(" scp upload --local <server> <remote-path> Pick from your machine via browser");
|
|
3114
3149
|
}
|
|
3115
3150
|
};
|
|
3116
3151
|
|
|
@@ -3302,6 +3337,7 @@ var scp = (() => {
|
|
|
3302
3337
|
this.description = "SCP-like file transfer between browser and remote servers";
|
|
3303
3338
|
this.author = DefaultLibraryAuthor;
|
|
3304
3339
|
this.version = LIBRARY_VERSION;
|
|
3340
|
+
this.metadata = { icon: "\u{1F4C1}", module: "file management" };
|
|
3305
3341
|
this.acceptsRawInput = true;
|
|
3306
3342
|
this.processors = [
|
|
3307
3343
|
new CliScpLsProcessor(),
|