1
Fork 0

Begin on the bulk move subcommand.

This commit is contained in:
Bauke 2023-03-05 16:10:30 +01:00
parent 34614124c4
commit 40e132c0df
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 35 additions and 0 deletions

View File

@ -1,10 +1,12 @@
import { Command } from "../dependencies.ts";
import { moveCommand } from "./move.ts";
import { runCommand } from "./run.ts";
async function main(): Promise<void> {
await new Command()
.name("bulk")
.description("Bulk doer of things.")
.command("move", moveCommand)
.command("run", runCommand)
.parse(Deno.args);
}

View File

@ -0,0 +1,33 @@
import { Command, prompt } from "../dependencies.ts";
export const moveCommand = new Command()
.name("move")
.description("Interactively move a group of files.")
.option(
"-d, --directory <directory:string>",
"Directories to include files from.",
{
collect: true,
},
)
.action(async ({
directory,
}) => {
await actionHandler({ directories: directory ?? [] });
});
async function actionHandler(
options: {
directories: string[];
},
): Promise<void> {
for (const directory of options.directories) {
for await (const file of Deno.readDir(directory)) {
if (!file.isFile) {
continue;
}
console.log(file);
}
}
}