Skip to content

Commit

Permalink
fix lint, fmt anda dd Deno.json and vscode support
Browse files Browse the repository at this point in the history
  • Loading branch information
mskian committed Aug 4, 2022
1 parent 784bb72 commit 69f30ba
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"deno.suggest.imports.hosts": {
"https://deno.land": true
}
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@ cd deno-random-words-cli
# Get Random Words
deno run --allow-net --allow-read main.ts -r

(or)

deno task random

#Get Pronunciation for a Word
deno run --allow-net --allow-read main.ts -p "Hello World"

(or)

deno task pronunciation "Hello World"

# Help Section
deno run --allow-net --allow-read main.ts -h

(or)

deno task help
```

- install CLI via Deno Script installer -
Expand Down
7 changes: 7 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tasks": {
"random": "deno run --allow-net --allow-read main.ts -r",
"pronunciation": "deno run --allow-net --allow-read main.ts -p",
"help": "deno run --allow-net --allow-read main.ts -h"
}
}
11 changes: 7 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const { args } = Deno;
import { parse } from "https://deno.land/std/flags/mod.ts";
import { parse } from "https://deno.land/std@0.150.0/flags/mod.ts";
import {
bold,
brightBlue,
brightGreen,
brightYellow,
} from "https://deno.land/std/fmt/colors.ts";
import { wait } from "https://deno.land/x/wait/mod.ts";
} from "https://deno.land/std@0.150.0/fmt/colors.ts";
import { wait } from "https://deno.land/x/wait@0.1.12/mod.ts";

const spinner = wait("Generating Words").start();
// deno-lint-ignore no-inferrable-types
const BASE_URL: string = "https://san-random-words.vercel.app/";
const parsedArgs = parse(args);

Expand Down Expand Up @@ -59,9 +60,11 @@ async function main() {
case "r":
await getRandomwords();
break;
// deno-lint-ignore no-fallthrough
case "pronunciation":
// deno-lint-ignore no-case-declarations
case "p":
let Pronunciation = parsedArgs.p || parsedArgs.Pronunciation ||
const Pronunciation = parsedArgs.p || parsedArgs.Pronunciation ||
"automation";
await getPronunciation(Pronunciation);
break;
Expand Down

0 comments on commit 69f30ba

Please sign in to comment.