Begin on the bulk move subcommand.
This commit is contained in:
parent
34614124c4
commit
40e132c0df
|
@ -1,10 +1,12 @@
|
||||||
import { Command } from "../dependencies.ts";
|
import { Command } from "../dependencies.ts";
|
||||||
|
import { moveCommand } from "./move.ts";
|
||||||
import { runCommand } from "./run.ts";
|
import { runCommand } from "./run.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
await new Command()
|
await new Command()
|
||||||
.name("bulk")
|
.name("bulk")
|
||||||
.description("Bulk doer of things.")
|
.description("Bulk doer of things.")
|
||||||
|
.command("move", moveCommand)
|
||||||
.command("run", runCommand)
|
.command("run", runCommand)
|
||||||
.parse(Deno.args);
|
.parse(Deno.args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue