Skip to content

Commit

Permalink
Documentation added
Browse files Browse the repository at this point in the history
  • Loading branch information
alcb1310 committed Apr 14, 2024
1 parent df812d1 commit b7cb318
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/

.env
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CLI-TOOL

## Description

The *CLI-TOOL* package is a CLI tool that can be used to create a CLI tool in Node.js. It can be used to create a CLI tool in Node.js. It can be used to create a CLI tool in Node.js.
Binary file added release/cli-tool.gz
Binary file not shown.
32 changes: 32 additions & 0 deletions release/cli-tool.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#! /usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
// Declare the progarm
const program = new commander_1.Command();
// Aadd actions onth that CLI
program
.command("greet <string>")
.argument("<string>", "string to greet")
.option("-c, --capitalize", "capitalize string")
.action((name, opts) => {
const cap = opts.capitalize ? name.toUpperCase() : name;
console.log(`Hello ${cap}`);
})
.description("Prints a greeting");
program
.command("add <numbers...>")
.action((numbers) => {
const sum = numbers.reduce((acc, number) => acc + number, 0);
console.log(`Sum: ${sum}`);
})
.description("Adds numbers and logs the result");
program
.command("get-max-number <numbers...>")
.action((numbers) => {
const max = Math.max(...numbers);
console.log(`Max: ${max}`);
})
.description("Gets the max number and logs the result");
// Excecute the CLI with the arguments
program.parse(process.argv);

0 comments on commit b7cb318

Please sign in to comment.