tooler-utility-cli
v1.0.3
Published
A Node.js CLI utility tool for file compression, string manipulation, and API fetching.
Maintainers
Readme
Tooler Utility CLI
A Node.js command-line utility tool for file compression, string manipulation, and fetching weather data via API.
Features
String Manipulation
- Convert file content to uppercase or lowercase
- Count words in a file
- Count palindromes in a file
File Compression
- Compress files using gzip
- Decompress
.gzfiles
Weather Data
- Fetch current weather information for any city using WeatherAPI
Installation
Clone the repository:
git clone https://github.com/Mohit-2803/cli_tool.git cd cli_toolInstall dependencies:
npm install(Optional) Link the CLI globally:
npm linkThis allows you to use
cli-toolfrom anywhere.
Usage
Run the CLI using:
node ./bin/index.js <command> [options]Or, if linked globally:
cli-tool <command> [options]Available Commands
String Manipulation
Uppercase
cli-tool upper <filePath>Converts file content to uppercase.
Lowercase
cli-tool lower <filePath>Converts file content to lowercase.
Word Count
cli-tool count <filePath>Counts words in the file.
Palindrome Count
cli-tool palindrome <filePath>Counts palindromes in the file.
File Compression
Compress
cli-tool compress <filePath>Compresses the file using gzip.
Decompress
cli-tool decompress <filePath.gz>Decompresses a
.gzfile.
Weather Data
- Get Weather
Fetches current weather for the specified city.cli-tool weather <city>
Example Usage
cli-tool upper ./notes.txt
cli-tool compress ./data.txt
cli-tool weather LondonEnvironment Variables
For weather data, you need an API key from WeatherAPI.
- Create a
.envfile in the project root:WEATHER_API_KEY=your_api_key_here
Logging
All errors and info messages are timestamped and printed to the console for easy debugging.
Project Structure
bin/
index.js # CLI entry point
commands/
compress.js # Compression commands
stringUtils.js # String manipulation commands
weather.js # Weather API command
utils/
logger.js # Logging utilityLicense
ISC © Mohit Sharma
Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Author
Mohit Sharma
