Skip to main content

latest

grep(mini version)

Works with
This package works with Deno
JSR Score
64%
Published
2 months ago

minigrep

How to use

Arguments need to be passed

  • query --- which want to search
  • filePath --- specify the file

Environment(Optional)

  • IGNORE_CASE --- whether case sensitive
import { ParseConfig, run } from "@iamwxq/minigrep";

try {
  run(ParseConfig.build(Deno.args));
} catch (err) {
  console.error(`Application error: ${err.message}`);
  Deno.exit(1);
}

Example

I'm nobody! Who are you?

Are you nobody, too?

Then there's a pair of us - don't tell!

They'd banish us, you know.

How dreary to be somebody!

How public, like a frog

To tell your name the livelong day

To an admiring bog!

case sensitive:

deno run --allow-env --allow-read main.ts to poem.txt

output:

Are you nobody, too?

How dreary to be somebody!

case insentitive:

IGNORE_CASE=1 && deno run --allow-env --allow-read main.ts to poem.txt

output:

Are you nobody, too?

How dreary to be somebody!

To tell your name the livelong day

To an admiring bog!

Add Package

deno add @iamwxq/minigrep

Import symbol

import * as mod from "@iamwxq/minigrep";