Skip to content

Commit f94aa3b

Browse files
pushing final changes
1 parent 9e4e527 commit f94aa3b

File tree

4 files changed

+80
-38
lines changed

4 files changed

+80
-38
lines changed

README.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
Welcome to **Zap CLI**! This command-line interface (CLI) tool is designed to provide a wide range of useful scripts and commands for various tasks. This repository features a collection of tools and utilities, all accessible through an intuitive and extensible CLI interface, making it easy to integrate into your daily workflows.
44

5-
Whether you need to perform calculations, manage expenses, generate secure passwords, take notes, convert units, or download YouTube videos, ZAP CLI has you covered. With its modular structure, you can easily extend its capabilities to fit your specific needs.
6-
75
## Features
86

97
- **Calculator**: Perform basic arithmetic operations with ease.
@@ -13,48 +11,45 @@ Whether you need to perform calculations, manage expenses, generate secure passw
1311
- **Unit Conversion**: Convert between various units of measurement seamlessly.
1412
- **YouTube Downloader**: Download your favorite videos from YouTube with simple commands.
1513

14+
## Installation Guide
1615

17-
## zap-cli Installation Guide
18-
To get started with `zap-cli`, follow these steps:
16+
To get started with **zap-cli**, follow these steps:
1917

2018
### 1. Clone the Repository
19+
2120
First, clone the repository to your local machine:
21+
2222
```bash
2323
git clone https://github.com/arsalan-dev-engineer/zap-cli.git
2424
```
2525

2626
### 2. Navigate to the Project Directory
27+
Change to the project directory:
2728
```bash
2829
cd zap-cli
2930
```
3031

3132
### 3. Make the Setup Script Executable
33+
Make the setup.sh script executable:
3234
```bash
33-
chmod +x scripting_tools/setup.sh
35+
chmod +x setup.sh
3436
```
3537

3638
### 4. Run the Setup Script
39+
Run the setup.sh script to set up the environment:
3740
```bash
38-
bash scripting_tools/setup.sh
41+
./setup.sh
3942
```
4043

41-
### The script will:
44+
## The script will:
4245
* Install the required dependencies (Python, virtual environment tools).
4346
* Create and activate a Python virtual environment.
4447
* Install the dependencies listed in requirements.txt.
4548
* Set up zap-cli.py as a global command.
4649

47-
### 5. After Installation
48-
Once the script has completed, you can use zap-cli anywhere on your Ubuntu terminal.
49-
To verify that zap-cli is working, simply type:
50-
```bash
51-
zap-cli --help
52-
```
50+
## 5. After Installation
51+
Once the script has completed, you can use zap-cli anywhere on your Ubuntu terminal. To verify that zap-cli is working, simply type:
5352

5453
### Notes:
55-
* Ensure that bash is installed on your system to run the setup script.
56-
* The setup script will create a virtual environment in the project folder and install all dependencies listed in requirements.txt.
57-
58-
59-
60-
54+
Ensure that bash is installed on your system to run the setup script.
55+
The setup script will create a virtual environment in the project folder and install all dependencies listed in requirements.txt.

requirements.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
2-
# This file lists all the dependencies required for the project.
3-
# Option1: Run: 'pip install -r requirements.txt' to install all dependencies mentioned in this file.
4-
# Option2 cd into 'scripting-tools' dir then run: './setup.sh' to install all dependencies.
1+
# ------------------------------------------------------------------------
2+
# This is the requirements.txt file for the zap-cli project.
3+
# It lists all the Python dependencies required to run the zap-cli command-line tool.
4+
# There are two ways to install these dependencies:
5+
#
6+
# Option 1: Run the following command to install all dependencies from this file:
7+
# pip install -r requirements.txt
8+
#
9+
# Option 2: Navigate to the 'scripting-tools' directory and run the setup.sh script:
10+
# cd scripting-tools
11+
# ./setup.sh
12+
#
13+
# The dependencies listed in this file are:
14+
# ------------------------------------------------------------------------
515

616
click
717
pytube

setup.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
11
from setuptools import setup, find_packages
22

3+
# ------------------------------------------------------------------------
4+
# This is the setup.py file for the zap-cli package.
5+
# It is used for packaging and distributing the zap-cli command-line tool.
6+
# It defines the metadata and configuration for the package, including:
7+
# - The package name, version, and dependencies.
8+
# - The entry point for the command-line tool.
9+
# - It also specifies the modules or packages that should be included
10+
# in the distribution (using find_packages).
11+
# ------------------------------------------------------------------------
12+
313
setup(
14+
# Name of the package (this is what will be used for installation)
415
name="zap-cli",
16+
17+
# Version of the package (helps in managing versions and dependencies)
518
version="0.1",
6-
packages=find_packages(), # Automatically finds the zap_cli package
19+
20+
# Automatically discover and include all Python packages in the zap_cli directory
21+
# Finds and includes all packages in the zap_cli module
22+
packages=find_packages(),
23+
24+
# List of dependencies that should be installed when the package is installed
725
install_requires=[
8-
'click', # Add any dependencies here, like 'requests', etc.
26+
# Required for building the command-line interface with Click
27+
'click',
28+
# Add any other external dependencies here (e.g., 'requests', 'flask', etc.)
929
],
30+
31+
# Entry points for creating executable commands via the command line
1032
entry_points={
1133
'console_scripts': [
12-
'zap-cli = zap_cli.zap_cli:cli', # Correct the path to the cli function
34+
# This defines a command called 'zap-cli' that runs the cli() function
35+
# from the zap_cli.zap_cli module (your main CLI script)
36+
# Points to the `cli` function in `zap_cli/zap_cli.py`
37+
'zap-cli = zap_cli.zap_cli:cli',
1338
],
1439
},
1540
)

setup.sh

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
#!/bin/bash
22

3-
# Exit on any error
3+
# ------------------------------------------------------------------------
4+
# This is the setup.sh script for the zap-cli project.
5+
# It is used to set up the environment and install dependencies for the zap-cli
6+
# command-line tool. The script performs the following tasks:
7+
# - Checks if Python 3 and the venv module are installed.
8+
# - Creates a virtual environment (venv) to isolate the project's dependencies.
9+
# - Installs all required dependencies from requirements.txt or setup.py.
10+
# - Installs the zap-cli package globally in editable mode.
11+
# - Ensures that the zap-cli tool is available for use in any directory.
12+
# ------------------------------------------------------------------------
13+
14+
# Exit the script if any command fails
415
set -e
516

6-
# Define the project directory
17+
# Get the current project directory
718
PROJECT_DIR="$(pwd)"
819

920
# 1. Check if Python and venv are installed
10-
echo "Checking Python and venv installation..."
21+
echo "Checking for Python and venv..."
1122
if ! command -v python3 &> /dev/null
1223
then
1324
echo "Python3 is not installed. Please install Python 3."
@@ -16,7 +27,7 @@ fi
1627

1728
if ! command -v python3 -m venv &> /dev/null
1829
then
19-
echo "venv module is not available. Installing..."
30+
echo "venv module is not available. Installing virtualenv..."
2031
python3 -m pip install --user virtualenv
2132
fi
2233

@@ -25,26 +36,27 @@ echo "Creating virtual environment..."
2536
python3 -m venv venv
2637

2738
# 3. Activate the virtual environment
39+
echo "Activating the virtual environment..."
2840
source venv/bin/activate
2941

30-
# 4. Install the packages from requirements.txt or setup.py
42+
# 4. Install dependencies from requirements.txt (or setup.py if no requirements.txt)
3143
echo "Installing dependencies..."
3244
if [[ -f "$PROJECT_DIR/requirements.txt" ]]; then
45+
# If requirements.txt exists, install the packages
3346
pip install -r "$PROJECT_DIR/requirements.txt"
3447
else
35-
echo "requirements.txt not found. Installing from setup.py..."
48+
# If no requirements.txt, install from setup.py
49+
echo "No requirements.txt found, installing from setup.py..."
3650
pip install .
3751
fi
3852

39-
# 5. Install zap-cli globally (editable mode)
53+
# 5. Install the zap-cli package globally in editable mode
4054
echo "Installing zap-cli globally in editable mode..."
4155
pip install -e .
4256

43-
# 6. Check if the installation was successful by running zap-cli
44-
echo "Checking zap-cli installation..."
45-
zap-cli --version
46-
47-
# 7. Deactivate the virtual environment
57+
# 6. Deactivate the virtual environment after setup is complete
58+
echo "Deactivating the virtual environment..."
4859
deactivate
4960

61+
# Final message
5062
echo "Setup complete! You can now use zap-cli globally."

0 commit comments

Comments
 (0)