@@ -3,7 +3,7 @@ import { Sandbox } from "@deno/sandbox";
33import { green , magenta , red } from "@std/fmt/colors" ;
44
55import { getAppFromConfig , readConfig , writeConfig } from "./config.ts" ;
6- import { renderTemporalTimestamp , withApp } from "./util.ts" ;
6+ import { error , renderTemporalTimestamp , withApp } from "./util.ts" ;
77import { createTrpcClient , getAuth } from "./auth.ts" ;
88import type { GlobalOptions } from "./main.ts" ;
99import { Spinner } from "@std/cli/unstable-spinner" ;
@@ -157,33 +157,32 @@ export const sandboxSshCommand = new Command<SandboxContext>()
157157 await sshIntoSandbox ( sandbox ) ;
158158 } ) ;
159159
160- /*
161160export const sandboxCopyCommand = new Command < SandboxContext > ( )
162161 . description ( "Copy files from or to a running sandbox" )
163- .example(
162+ /* .example(
164163 "Copy a file from a sandbox to the local machine",
165- "copy someSandboxId:/app/remote-file.txt ./local-file.txt"
166- )
164+ "copy someSandboxId:/app/remote-file.txt ./local-file.txt",
165+ )*/
167166 . example (
168167 "Copy a file from the local machine to a sandbox" ,
169- "copy ./local-file.txt someSandboxId:/app/remote-file.txt"
168+ "copy ./local-file.txt someSandboxId:/app/remote-file.txt" ,
170169 )
171- .example(
170+ /* .example(
172171 "Copy multiple files from a sandbox to the local machine",
173- "copy someSandboxId:/app/remote-file.txt someSandboxId:/app/another-remote-file.txt ./"
174- )
172+ "copy someSandboxId:/app/remote-file.txt someSandboxId:/app/another-remote-file.txt ./",
173+ )*/
175174 . example (
176175 "Copy multiple files from the local machine to a sandbox" ,
177- "copy ./local-file.txt ./another-local-file.txt someSandboxId:/app/"
176+ "copy ./local-file.txt ./another-local-file.txt someSandboxId:/app/" ,
178177 )
179178 . example (
180179 "Copy a directory from the local machine to a sandbox" ,
181- "copy ./ ./another-local-file.txt someSandboxId:/app/"
180+ "copy ./ ./another-local-file.txt someSandboxId:/app/" ,
182181 )
183- .example(
182+ /* .example(
184183 "Copy files from a sandbox to another sandbox",
185- "copy someSandboxId:/app/remote-file.txt anotherSandboxId:/app/remote-file.txt"
186- )
184+ "copy someSandboxId:/app/remote-file.txt anotherSandboxId:/app/remote-file.txt",
185+ )*/
187186 . arguments ( "<paths...:string>" )
188187 . action ( async ( options , ...paths ) => {
189188 if ( paths . length < 2 ) {
@@ -196,29 +195,34 @@ export const sandboxCopyCommand = new Command<SandboxContext>()
196195 const [ sandboxId , sandboxPath ] = target . split ( ":" ) ;
197196 await using sandbox = await connectToSandbox ( options , sandboxId ) ;
198197
199- const sourceSandboxPaths = [];
198+ // const sourceSandboxPaths = [];
200199 const localPaths = [ ] ;
201200
202201 for ( const path of paths ) {
203202 if ( path . includes ( ":" ) ) {
204- sourceSandboxPaths.push(path);
203+ error (
204+ options . debug ,
205+ "Copying between sandboxes is currently not supported" ,
206+ ) ;
207+
208+ //sourceSandboxPaths.push(path);
205209 } else {
206210 localPaths . push ( path ) ;
207211 }
208212 }
209213
210- const sourceSandboxGroups = groupPathsBySandbox(sourceSandboxPaths);
214+ /* const sourceSandboxGroups = groupPathsBySandbox(sourceSandboxPaths);
211215 const sourceSandboxes: Record<string, Sandbox> = {};
212216
213217 for (const sandboxId of Object.keys(sourceSandboxGroups)) {
214218 sourceSandboxes[sandboxId] = await connectToSandbox(options, sandboxId);
215- }
219+ }*/
216220
217221 await Promise . all ( [
218222 ...localPaths . map ( ( path ) => {
219223 return sandbox . upload ( path , sandboxPath ) ;
220224 } ) ,
221- ...Object.entries(sourceSandboxGroups).map(
225+ /* ...Object.entries(sourceSandboxGroups).map(
222226 async ([sandboxId, sourceSandboxPaths]) => {
223227 const sourceSandbox = sourceSandboxes[sandboxId];
224228
@@ -232,10 +236,12 @@ export const sandboxCopyCommand = new Command<SandboxContext>()
232236
233237 await sandbox.close();
234238 },
235- ),
239+ ),*/
236240 ] ) ;
237241 } else {
238- for (const path of paths) {
242+ error ( options . debug , "Copying from sandboxes is currently not supported" ) ;
243+
244+ /*for (const path of paths) {
239245 if (!path.includes(":")) {
240246 error(
241247 options.debug,
@@ -261,10 +267,9 @@ export const sandboxCopyCommand = new Command<SandboxContext>()
261267
262268 await sandbox.close();
263269 }),
264- );
270+ );*/
265271 }
266272 } ) ;
267- */
268273
269274export const sandboxExecCommand = new Command < SandboxContext > ( )
270275 . description ( "Execute a command in a running sandbox" )
@@ -541,8 +546,8 @@ export const sandboxCommand = new Command<GlobalOptions>()
541546 . command ( "kill" , sandboxKillCommand )
542547 . alias ( "remove" )
543548 . alias ( "rm" )
544- /* .command("copy", sandboxCopyCommand)
545- .alias("cp")*/
549+ . command ( "copy" , sandboxCopyCommand )
550+ . alias ( "cp" )
546551 . command ( "exec" , sandboxExecCommand )
547552 . command ( "run" , sandboxRunCommand )
548553 . command ( "ssh" , sandboxSshCommand ) ;
0 commit comments