pravinkori / node-cli-app

A simple node based CLI notes application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notes CLI (Command-Line Interface)

This is a command-line interface (CLI) for managing notes using yargs in Node.js. The application provides various commands to interact with notes, including creating new notes, retrieving all notes, finding notes based on a filter, removing a note by ID, launching a placeholder website to view notes, and cleaning (removing) all notes.

Prerequisites

Before running the project, ensure that you have Node.js and npm (Node Package Manager) installed on your machine.

Installation

  1. Clone the repository or download the source code.
git clone https://github.com/pravinkori/node-cli-app.git
cd node-cli-app
  1. Install project dependencies.
npm install

Run the Project

The project includes a binary named "note" that can be executed from the command line. Use the following command to run the project:

sudo npm link
note <command> [options]

Replace <command> with one of the available commands (e.g., "new", "all", "find", "remove", "web", "clean") and provide any required options based on the chosen command.

Available Commands

1. Create a New Note

note new <note> [--tags, -t]
  • <note>: The content of the note you want to create.
  • --tags, -t: Tags to add to the note (optional).

Example:

note new "Meeting at 3 PM" --tags work, important

2. Get All Notes

note all

3. Find Matching Notes

note find <filter>
  • <filter>: The search term to filter notes by, applied to note.content.

Example:

note find important

4. Remove a Note by ID

note remove <id>
  • <id>: The ID of the note you want to remove.

Example:

note remove 1

5. Remove All Notes

note clean

Testing

To run tests, execute the following command:

npm test

This command uses Jest for testing. Jest will run the test suites and report the results.

Additional Information

  • The project uses the "yargs" library for handling command-line arguments.
  • Jest is used for testing.
  • The project is written in ECMAScript modules (ESM) as indicated by the "type": "module" field in the package.json file.

Notes Management Functions

The commands are associated with corresponding functions from the notes.js module for note management.

  • newNote: Creates a new note with optional tags.
  • getAllNotes: Retrieves all notes.
  • findNotes: Finds notes matching a provided filter.
  • removeNote: Removes a note by specifying its ID.
  • removeAllNotes: Removes all notes.

Additional Information

  • The application uses the yargs library for handling command-line arguments.
  • The server.js module is used for launching a placeholder website (functionality not fully implemented).
  • The utility.js module includes a listNotes function for displaying notes.

Feel free to explore and manage your notes using this simple command-line interface!

About

A simple node based CLI notes application


Languages

Language:JavaScript 98.1%Language:HTML 1.9%