Gleam SDK for Pocketenv
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Reformat Gleam code

+27 -18
+26 -14
src/pocketenv/copy.gleam
··· 30 30 fn compress_ffi(source_path: String) -> Result(String, String) 31 31 32 32 @external(erlang, "pocketenv_copy_ffi", "decompress") 33 - fn decompress_ffi(archive_path: String, dest_path: String) -> Result(Nil, String) 33 + fn decompress_ffi( 34 + archive_path: String, 35 + dest_path: String, 36 + ) -> Result(Nil, String) 34 37 35 38 @external(erlang, "pocketenv_copy_ffi", "read_file") 36 39 fn read_file(path: String) -> Result(BitArray, String) ··· 56 59 directory_path: String, 57 60 ) -> Result(String, PocketenvError) { 58 61 let body = 59 - json.to_string(json.object([ 60 - #("sandboxId", json.string(sandbox_id)), 61 - #("directoryPath", json.string(directory_path)), 62 - ])) 62 + json.to_string( 63 + json.object([ 64 + #("sandboxId", json.string(sandbox_id)), 65 + #("directoryPath", json.string(directory_path)), 66 + ]), 67 + ) 63 68 use resp_body <- result.try(do_post( 64 69 client, 65 70 "/xrpc/io.pocketenv.sandbox.pushDirectory", ··· 82 87 directory_path: String, 83 88 ) -> Result(Nil, PocketenvError) { 84 89 let body = 85 - json.to_string(json.object([ 86 - #("uuid", json.string(uuid)), 87 - #("sandboxId", json.string(sandbox_id)), 88 - #("directoryPath", json.string(directory_path)), 89 - ])) 90 + json.to_string( 91 + json.object([ 92 + #("uuid", json.string(uuid)), 93 + #("sandboxId", json.string(sandbox_id)), 94 + #("directoryPath", json.string(directory_path)), 95 + ]), 96 + ) 90 97 use _ <- result.try(do_post( 91 98 client, 92 99 "/xrpc/io.pocketenv.sandbox.pullDirectory", ··· 103 110 token: String, 104 111 storage_url: String, 105 112 ) -> Result(String, PocketenvError) { 106 - use content <- result.try(read_file(archive_path) |> result.map_error(HttpError)) 113 + use content <- result.try( 114 + read_file(archive_path) |> result.map_error(HttpError), 115 + ) 107 116 let boundary = "FormBoundary" <> random_hex(8) 108 117 let crlf = "\r\n" 109 118 let body = ··· 229 238 use uuid <- result.try(push_directory(sb.client, sb.data.id, sandbox_path)) 230 239 let archive = temp_path() 231 240 let result = { 232 - use _ <- result.try( 233 - download_from_storage(uuid, archive, sb.client.token, sb.client.storage_url), 234 - ) 241 + use _ <- result.try(download_from_storage( 242 + uuid, 243 + archive, 244 + sb.client.token, 245 + sb.client.storage_url, 246 + )) 235 247 decompress_ffi(archive, local_path) |> result.map_error(HttpError) 236 248 } 237 249 let _ = delete_file(archive)
+1 -4
test/pocketenv_test.gleam
··· 528 528 let assert Ok(Nil) = 529 529 write_file(dir <> "/src/main.go", bit_array.from_string("package main")) 530 530 let assert Ok(Nil) = 531 - write_file( 532 - dir <> "/src/build/output", 533 - bit_array.from_string("compiled"), 534 - ) 531 + write_file(dir <> "/src/build/output", bit_array.from_string("compiled")) 535 532 let assert Ok(Nil) = 536 533 write_file( 537 534 dir <> "/src/.pocketenvignore",