Socket
Socket
Sign inDemoInstall

@abhishekwl/dict_cli

Package Overview
Dependencies
17
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @abhishekwl/dict_cli

Robust CLI based thesaurus to play with. Focused on code structure and file organisation. Built using `commander` (CLI operations) and `chalk` (console coloring). Makes API calls to [dictionaryapi.com](https://dictionaryapi.com/products/api-intermediate-t


Version published
Weekly downloads
4
Maintainers
1
Created
Weekly downloads
 

Readme

Source

🔨 dict (Stack Finance Task)

Robust CLI based thesaurus to play with. Focused on code structure and file organisation. Built using commander (CLI operations) and chalk (console coloring). Makes API calls to dictionaryapi.com to fetch definitions, synonyms, antonyms and usage examples of a given word.

🏗 Usage

Usage: dict [options] [command]

Options:
  -v, --version   Displays the current version of the CLI
  -h, --help      display help for command

Commands:
  def <word>      Display definitions of a word
  syn <word>      Display synonyms of a word
  ant <word>      Display antonyms of a word
  ex <word>       Display examples of a word
  play            Let's play a game
  help [command]  display help for command

📚 Directory Structure

.
├── README.md
├── index.js
├── package.json
├── src
│   ├── shared
│   │   ├── commands.metadata.json
│   │   ├── constants.js
│   │   └── random.words.txt
│   ├── thesaurus
│   │   ├── controller
│   │   │   ├── antonym.controller.js
│   │   │   ├── definition.controller.js
│   │   │   ├── example.controller.js
│   │   │   ├── full-dict.controller.js
│   │   │   ├── play.controller.js
│   │   │   └── synonym.controller.js
│   │   ├── enums
│   │   │   └── command.enum.js
│   │   ├── helpers
│   │   │   └── play.helper.js
│   │   └── services
│   │       └── thesaurus.service.js
│   └── util
│       └── index.js
└── yarn.lock

🚀 Done so far

  • Implemented enums for command names.
  • Separation of concerns, service layer deals with API calls, controller deals with CLI interaction, helpers aid controllers with functions specific to the module.
  • shared directory contains globally shared resources such as constants and command information.
  • Utility functions are stored in util directory.
  • Error management at every stage with try/catch being implemented with various error types at the service level as well as the controller level.
  • Minimalist index.js entrypoint with necessary imports only.

📣 Possible Enhancements

  • Fetch API key from environment variables, storing it in code to make testing easier.
  • Use jsconfig paths to make relative imports easier.
  • Implements typescript to ensure types.
  • Improve CLI interface (prettify).
  • Display a friendly did you mean message if a command is not found.
  • Add autoupdate support to the CLI.
  • Add bash/zsh autocomplete.

🌈 Screenshots

  1. Definition

Definition

  1. Synonym

Synonym

  1. Antonym

Antonym

  1. Example

Example

  1. Full Dictionary

Full Dict

  1. Word of the day

Word of the day

  1. Game

Play

Keywords

FAQs

Last updated on 05 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc