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.
Before running the project, ensure that you have Node.js and npm (Node Package Manager) installed on your machine.
- Node.js: Download Node.js
- npm (comes with Node.js installation)
- Clone the repository or download the source code.
git clone https://github.com/pravinkori/node-cli-app.git
cd node-cli-app
- Install project dependencies.
npm install
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.
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
note all
note find <filter>
<filter>
: The search term to filter notes by, applied tonote.content
.
Example:
note find important
note remove <id>
<id>
: The ID of the note you want to remove.
Example:
note remove 1
note clean
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.
- 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 thepackage.json
file.
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.
- 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 alistNotes
function for displaying notes.
Feel free to explore and manage your notes using this simple command-line interface!