1.0.5 • Published 2 years ago

bens-trie v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Client CLI

My CLI is available as a public npm package called bens-trie.

Installation

To install the CLI with npx, run npm install bens-trie. After that, you can run the CLI using npx bens-trie <command>. If you do not have npx installed, install it using npm install -g npx.

If you'd prefer to install the CLI globally, run npm install -g bens-trie. This adds the CLI to your path, allowing you to simply run bens-trie <command>.

You can also run the CLI locally (instead of installing the version I released) by running npm start from the client directory of the project. You can then run all of the below commands.

Usage

If you're running the CLI through npx instead of globally, you'll need to prefix all these commands with npx. For example, npx bens-trie add <word>.

bens-trie add <word>

Adds word to the trie.

Example: bens-trie add test

Output: Successfully added word "test"

bens-trie delete <word>

Deletes word from the trie.

Example: bens-trie delete test

Output: Successfully deleted word "test"

bens-trie search <word>

Searches for word in the trie and prints whether it is in the trie.

Example: bens-trie search test

Output: Word "test" IS in the trie (assuming we didn't delete test from the trie)

bens-trie autocomplete <prefix>

Auto-completes prefix and prints all words that begin with the prefix.

If no prefix is specified, all words in the trie are printed.

Example: bens-trie autocomplete t

Output:

Search results for "t":
test

bens-trie display

Prints the trie, with one node on each line and lines connecting nodes. Words are printed to the right of their last letter.

Example: bens-trie display with words "trie", "tree", "talk", and "add" in the trie:

ROOT
|
|—a
| |—d
|   |—d add
|—t
  |—a
  | |—l
  |   |—k talk
  |—r
    |—e
    | |—e tree
    |—i
      |—e trie

bens-trie --help

Shows all available commands and their usage.

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago