Skip to content

Commit b4cf09a

Browse files
committed
feat: add codeflare s3 select command
1 parent b5e85ec commit b4cf09a

File tree

1 file changed

+17
-7
lines changed
  • plugins/plugin-codeflare/src/controller

1 file changed

+17
-7
lines changed

plugins/plugin-codeflare/src/controller/s3.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Registrar } from "@kui-shell/core"
17+
import { Arguments, Registrar } from "@kui-shell/core"
18+
19+
async function dirs(args: Arguments) {
20+
const { join } = await import("path")
21+
await import("@kui-shell/plugin-s3").then((_) => _.enable())
22+
return args.argvNoOptions.slice(3).map((_) => join("/s3", _))
23+
}
24+
25+
async function ls(args: Arguments) {
26+
return args.REPL.qexec("ls " + (await dirs(args)).join(" "))
27+
}
28+
29+
async function select(args: Arguments) {
30+
return args.REPL.qexec("ls " + (await dirs(args)).join(" "))
31+
}
1832

1933
export default function s3Behaviors(registrar: Registrar) {
20-
registrar.listen("/codeflare/s3/ls", async (args) => {
21-
const { join } = await import("path")
22-
await import("@kui-shell/plugin-s3").then((_) => _.enable())
23-
const rest = args.argvNoOptions.slice(3).map((_) => join("/s3", _))
24-
return args.REPL.qexec("ls " + rest.join(" "))
25-
})
34+
registrar.listen("/codeflare/s3/ls", ls)
35+
registrar.listen("/codeflare/s3/select", select, { needsUI: true })
2636
}

0 commit comments

Comments
 (0)