mirror of
https://github.com/codeninjasgg/code-sensei.git
synced 2025-04-28 15:24:41 -04:00
created ninja-logs cli
This commit is contained in:
parent
37440d1a9f
commit
65889c72c7
5 changed files with 37 additions and 18 deletions
ninja-logs
|
@ -3,5 +3,5 @@
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
deno install https://github.com/EthanThatOneKid/code-sensei/main/blob/ninja-logs/mod.ts
|
deno run --unstable --allow-read cli.ts
|
||||||
```
|
```
|
||||||
|
|
18
ninja-logs/cli.ts
Normal file
18
ninja-logs/cli.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { Command } from "https://deno.land/x/cliffy@v0.17.2/command/mod.ts";
|
||||||
|
import ninjaLogs from "./mod.ts";
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const { options } = await new Command()
|
||||||
|
.name("nl")
|
||||||
|
.version("0.0.1")
|
||||||
|
.description("command line interface for deno")
|
||||||
|
.option("-t, --template", "path of desired template", { required: true })
|
||||||
|
.parse(Deno.args);
|
||||||
|
await ninjaLogs({ template: options.template });
|
||||||
|
};
|
||||||
|
|
||||||
|
if (import.meta.main) {
|
||||||
|
await main();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default main;
|
16
ninja-logs/mod.ts
Normal file
16
ninja-logs/mod.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { walk } from "https://deno.land/std/fs/mod.ts";
|
||||||
|
|
||||||
|
interface Config {
|
||||||
|
template: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function (config: Config): Promise<void> {
|
||||||
|
let templatePath = "";
|
||||||
|
for await (const entry of walk("./templates/")) {
|
||||||
|
if (entry.path.replace(/\\+/g, "/").includes(config.template)) {
|
||||||
|
templatePath = entry.path;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log({ templatePath });
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
// filename: "nl"
|
|
||||||
// `nl` is short for "Ninja Logs"
|
|
||||||
|
|
||||||
import { Command } from "https://deno.land/x/cliffy@v0.17.2/command/mod.ts";
|
|
||||||
|
|
||||||
const main = async () => {
|
|
||||||
await new Command()
|
|
||||||
.name("nl")
|
|
||||||
.version("0.0.1")
|
|
||||||
.description("Command line interface for Deno")
|
|
||||||
.parse(Deno.args);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (import.meta.main) {
|
|
||||||
await main();
|
|
||||||
}
|
|
|
@ -1 +1,2 @@
|
||||||
Coconut chaos is awesome.
|
Today, your child, {NAME}, completed the game, Coconut Chaos.
|
||||||
|
They did an awesome job!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue