Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a1a509a
feat: add enhanced error handling and global variables to archive-create
Oct 10, 2025
e48d839
feat: add input validation and logging functions to archive-create
Oct 10, 2025
be2e269
feat: enhance ask_extension function with logging and dry-run support
Oct 10, 2025
eb6f4a4
feat: add comprehensive command line options and batch processing to …
Oct 10, 2025
d3b1278
feat: add enhanced error handling and global variables to archive-ext…
Oct 10, 2025
2e989bf
feat: add validation, logging functions and help to archive-extract
Oct 10, 2025
9a78f72
feat: enhance archive-extract with command line parsing and improved …
Oct 10, 2025
0dced78
feat: add checksum verification functions to archive-create
Oct 10, 2025
903a9b8
feat: add checksum verification to archive-extract
Oct 10, 2025
218e7e4
feat: add progress indicator functions to archive-create
Oct 10, 2025
b3a7157
feat: add configuration file support
Oct 10, 2025
cec8e52
feat: add configuration loading to archive-create
Oct 10, 2025
32d219c
feat: add configuration loading to archive-extract
Oct 10, 2025
d3cdc82
feat: add JSON output functions to archive-create
Oct 10, 2025
9b7c4b0
feat: add JSON output functions to archive-extract
Oct 10, 2025
3228432
feat: add parallel processing support to archive-create batch mode
Oct 10, 2025
1461441
feat: add parallel processing support to archive-extract batch mode
Oct 10, 2025
b5834ac
feat: add comprehensive test script for enhanced features
Oct 10, 2025
da5bda8
feat: add man page for archive-create
Oct 10, 2025
e446fde
feat: add man page for archive-extract
Oct 10, 2025
20c36fc
feat: update README with comprehensive features section
Oct 10, 2025
bedcd7a
feat: add bash completion script for enhanced user experience
Oct 10, 2025
7c6a940
feat: add GitHub Actions CI/CD workflow for automated testing
Oct 10, 2025
f87c9a6
feat: add comprehensive changelog documenting all enhancements
Oct 10, 2025
1a68693
fix: resolve function definition order and improve CI/CD workflow
Oct 10, 2025
aeb41b2
feat: updated readme
Oct 10, 2025
2628f7f
fix: correct parallel processing to avoid recursive calls in batch mode
Oct 10, 2025
d72b4fe
fix: move logging functions before load_config to prevent command not…
Oct 10, 2025
ce3420f
fix: move extract_archive function definition before it's called to p…
Oct 10, 2025
881068b
fix: correct parallel processing paths and remove /dev/tty dependency…
Oct 10, 2025
b9a9a57
feat: updated changelog
Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Archive CLI Tests

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Bash
run: |
echo "Bash version:"
bash --version

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y tar gzip bzip2 xz-utils zip unzip p7zip-full
# Install GNU parallel for parallel processing tests
sudo apt-get install -y parallel
# Install rar/unrar if available
sudo apt-get install -y unrar || echo "unrar not available, skipping"

- name: Make scripts executable
run: |
chmod +x archive-create archive-extract test-archive-cli.sh

- name: Create test file first
run: |
echo "test content" > test.txt

- name: Run basic functionality tests
run: |
echo "Testing basic archive creation..."
./archive-create -v test.txt
ls -la test.txt.tar.gz

- name: Run archive extraction tests
run: |
echo "Testing archive extraction..."
./archive-extract -v test.txt.tar.gz
ls -la test.txt

- name: Test help output
run: |
echo "Testing help output..."
./archive-create -h
./archive-extract -h

- name: Test dry run mode
run: |
echo "Testing dry run mode..."
./archive-create -d -v test.txt
./archive-extract -d -v test.txt.tar.gz

- name: Test JSON output
run: |
echo "Testing JSON output..."
./archive-create -j -v test.txt > output.json
cat output.json

- name: Test batch mode
run: |
echo "Testing batch mode..."
echo "file1" > file1.txt
echo "file2" > file2.txt
./archive-create -b -v file1.txt file2.txt
ls -la file1.txt.tar.gz file2.txt.tar.gz

- name: Test configuration
run: |
echo "Testing configuration file..."
if [ -f config ]; then
echo "Configuration file found"
cat config
else
echo "No configuration file"
fi

- name: Test error handling
run: |
echo "Testing error handling..."
./archive-create nonexistent-file 2>/dev/null || echo "Error handling works"

- name: Test script syntax
run: |
echo "Testing script syntax..."
bash -n archive-create
bash -n archive-extract
echo "Script syntax is valid"

- name: Cleanup
run: |
rm -f test.txt test.txt.tar.gz file1.txt file2.txt file1.txt.tar.gz file2.txt.tar.gz output.json
117 changes: 117 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Changelog

All notable changes to the Archive CLI project will be documented in this file.

## [2.0.0] - 2024-12-19

### **Major Enhancements**

#### **Enhanced Functionality**
- **Progress Indicators**: Added visual progress bars for long operations
- **Batch Processing**: Implemented batch processing for multiple files/archives
- **Parallel Processing**: Added automatic parallel processing when GNU parallel is available
- **Checksum Verification**: Implemented SHA256 checksum generation and verification
- **JSON Output**: Added machine-readable output for scripting and automation
- **Configuration Support**: Added user and local configuration file support
- **Dry Run Mode**: Implemented preview operations without executing them
- **Interactive Mode**: Added user-friendly interactive archive creation
- **Compression Levels**: Added configurable compression levels (1-9)
- **Verbose/Quiet Modes**: Added detailed logging or minimal output options

#### **Security Improvements**
- **Path Sanitization**: Added protection against directory traversal attacks
- **Input Validation**: Implemented comprehensive input validation and sanitization
- **File Size Limits**: Added configurable file size warnings
- **Checksum Verification**: Added automatic integrity checking

#### **Modern CLI Features**
- **Command Line Options**: Added extensive command-line interface with help
- **Configuration Files**: Added support for user and local configuration
- **Man Pages**: Added comprehensive manual pages for both tools
- **Test Suite**: Added comprehensive test script for validation
- **Cross-Platform**: Enhanced Windows compatibility

#### **Technical Enhancements**
- **Error Handling**: Implemented robust error handling with `set -euo pipefail`
- **Logging System**: Added structured logging with different verbosity levels
- **Input Validation**: Added path traversal protection and file validation
- **Progress Tracking**: Added real-time progress indicators for operations
- **Batch Operations**: Added efficient processing of multiple files
- **Parallel Execution**: Added automatic parallel processing when available

#### **Documentation**
- **Enhanced Help**: Added comprehensive help with examples
- **Man Pages**: Added professional manual pages
- **Configuration Guide**: Added configuration file documentation
- **Test Scripts**: Added automated testing and validation
- **Bash Completion**: Added shell completion for enhanced user experience
- **CI/CD**: Added GitHub Actions workflow for automated testing

### **Technical Details**

#### **New Command Line Options**
- `-v`: Verbose output with detailed logging
- `-q`: Quiet mode (minimal output)
- `-d`: Dry run mode (show what would be done)
- `-j`: JSON output format for scripting
- `-b`: Batch mode for multiple files/archives
- `-c LEVEL`: Compression level (1-9, default: 6)
- `-t DEST`: Extract to specific directory (archive-extract only)
- `-h`: Print help information

#### **Configuration File Support**
- User configuration: `~/.archive-cli/config`
- Local configuration: `./config`
- Configurable defaults for all major options

#### **New Files Added**
- `config`: Default configuration file
- `test-archive-cli.sh`: Comprehensive test script
- `archive-create.1`: Man page for archive-create
- `archive-extract.1`: Man page for archive-extract
- `archive-cli-completion.bash`: Bash completion script
- `.github/workflows/test.yml`: CI/CD workflow
- `CHANGELOG.md`: This changelog

#### **Enhanced Scripts**
- `archive-create`: Completely enhanced with modern features
- `archive-extract`: Completely enhanced with modern features

### **Bug Fixes**
- Fixed error handling inconsistencies
- Added proper input validation
- Fixed path traversal vulnerabilities
- Improved error messages and logging

### **Performance Improvements**
- Added parallel processing support
- Implemented progress indicators
- Added batch processing capabilities
- Optimized error handling and validation

### **Security Enhancements**
- Added path sanitization
- Implemented input validation
- Added file size limits
- Added checksum verification

### **Documentation**
- Added comprehensive README with features section
- Added man pages for both tools
- Added configuration documentation
- Added test documentation
- Added CI/CD documentation

### **Testing**
- Added comprehensive test script
- Added GitHub Actions CI/CD
- Added automated testing
- Added error handling tests

## [1.0.0] - 2019

### **Initial Release**
- Basic archive creation and extraction functionality
- Support for common archive formats
- Simple command-line interface
- Debian package support
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,45 @@ The script take care of the file extension to call the good command.

### Manually
you can use a simple `git clone`

## Features Added

### **Enhanced Functionality**
- **Progress Indicators**: Visual progress bars for long operations
- **Batch Processing**: Process multiple files/archives simultaneously
- **Parallel Processing**: Automatic parallel processing when GNU parallel is available
- **Checksum Verification**: Automatic SHA256 checksum generation and verification
- **JSON Output**: Machine-readable output for scripting and automation
- **Configuration Support**: User and local configuration files
- **Dry Run Mode**: Preview operations without executing them
- **Enhanced Error Handling**: Comprehensive error handling and validation
- **Interactive Mode**: User-friendly interactive archive creation
- **Compression Levels**: Configurable compression levels (1-9)
- **Verbose/Quiet Modes**: Detailed logging or minimal output options

### **Security Improvements**
- **Path Sanitization**: Protection against directory traversal attacks
- **Input Validation**: Comprehensive input validation and sanitization
- **File Size Limits**: Configurable file size warnings
- **Checksum Verification**: Automatic integrity checking

### **Modern CLI Features**
- **Command Line Options**: Extensive command-line interface with help
- **Configuration Files**: Support for user and local configuration
- **Man Pages**: Comprehensive manual pages for both tools
- **Test Suite**: Comprehensive test script for validation
- **Cross-Platform**: Enhanced Windows compatibility

### **Technical Enhancements**
- **Error Handling**: Robust error handling with `set -euo pipefail`
- **Logging System**: Structured logging with different verbosity levels
- **Input Validation**: Path traversal protection and file validation
- **Progress Tracking**: Real-time progress indicators for operations
- **Batch Operations**: Efficient processing of multiple files
- **Parallel Execution**: Automatic parallel processing when available

### **Documentation**
- **Enhanced Help**: Comprehensive help with examples
- **Man Pages**: Professional manual pages
- **Configuration Guide**: Configuration file documentation
- **Test Scripts**: Automated testing and validation
63 changes: 63 additions & 0 deletions archive-cli-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Archive CLI Bash Completion
# Source this file to enable tab completion for archive-create and archive-extract

_archive_create_completion() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

opts="-a -v -q -d -j -b -c -h"

case "${prev}" in
-c)
COMPREPLY=( $(compgen -W "1 2 3 4 5 6 7 8 9" -- ${cur}) )
return 0
;;
-h)
return 0
;;
esac

if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi

# Complete files and directories
COMPREPLY=( $(compgen -f -- ${cur}) )
return 0
}

_archive_extract_completion() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

opts="-v -q -d -j -b -t -h"

case "${prev}" in
-t)
COMPREPLY=( $(compgen -d -- ${cur}) )
return 0
;;
-h)
return 0
;;
esac

if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi

# Complete archive files
COMPREPLY=( $(compgen -f -X "!*.{tar,tar.gz,tgz,tar.bz2,tbz2,tar.xz,tar.Z,taz,zip,rar,jar,gz,bz2,xz,7z}" -- ${cur}) )
return 0
}

complete -F _archive_create_completion archive-create
complete -F _archive_extract_completion archive-extract

echo "Archive CLI completion enabled. Use 'source archive-cli-completion.bash' to enable."
Loading