Skip to content

Latest commit

 

History

History
155 lines (107 loc) · 3.39 KB

README.md

File metadata and controls

155 lines (107 loc) · 3.39 KB

Shell Utilities

Collection of simple shell functionalities to enhance your development workflow.

Collection

1. work.sh - Project Quick Launcher

Quickly open VS Code in your project directories with smart tab completion.

Features

  • Opens VS Code in workspace directories under a configured base path
  • Tab completion for available project folders
  • Directory existence validation
  • Compatible with both bash and zsh
  • Optional terminal auto-close after launching VS Code

Usage

work [-c] <project-name>  # -c flag keep terminal alive after opening

Example:

work frontend  # Opens VS Code in /path/to/your/projects/frontend

Use TAB after typing work for directory autocompletion.

2. sail-init.sh - Laravel Sail Project Initializer

Automates the creation and initial setup of Laravel projects using Laravel Sail.

Features

  • Creates new Laravel project with Sail
  • Starts Docker containers automatically
  • Smart health checking for application readiness
  • Runs initial database migrations
  • Provides helpful feedback and progress indicators
  • Maximum 60-second timeout for startup

Usage

sail-init <project-name>

Example:

sail-init my-new-app

The script will:

  1. Create a new Laravel project
  2. Start Sail containers
  3. Wait for the application to be ready (health checks)
  4. Run database migrations
  5. Display useful Sail commands

3. file-organizer.sh - File Organization Script

Organizes files with the same base name and different extensions into a dedicated folder.

Features

  • Moves files with specified base name and extensions into a new directory
  • Comprehensive error handling and input validation
  • Detailed logging to both console and log file
  • Compatible with both bash and zsh
  • Production-level script with best practices

Usage

file-organizer <base_name> <extension1> [extension2] ...

Example:

file-organizer myfile txt pdf doc  # Creates myfile/ and moves myfile.txt, myfile.pdf, myfile.doc into it

The script will:

  1. Create a timestamped log file in /tmp
  2. Validate all inputs and file existence
  3. Create the target directory if needed
  4. Move matching files
  5. Clean up empty directories if no files were moved
  6. Provide detailed feedback of all operations

Installation

  1. Clone the repository to the shell utilities directory:
git clone https://github.com/yourusername/shell-utils.git "${HOME}/shell-utils"
  1. For work.sh, set your projects base path by editing the script or adding to your shell config:
export BASE_PATH="/path/to/your/projects"
  1. Source the utilities and scripts in your shell configuration file:
# Add to ~/.bashrc or ~/.zshrc
source "${HOME}/shell-utils/utils.sh"
source "${HOME}/shell-utils/work.sh"
source "${HOME}/shell-utils/sail.sh"
source "${HOME}/shell-utils/file-organizer.sh"
  1. Create the logs directory:
mkdir -p "${HOME}/.logs/shell-utils"
  1. Reload your shell configuration:
source ~/.bashrc  # or ~/.zshrc

Directory Structure

${HOME}/
├── shell-utils/
│   ├── utils.sh
│   ├── work.sh
│   ├── sail.sh
│   └── file-organizer.sh
└── .logs/
    └── shell-utils/
        └── [script logs]

Contributing

Feel free to suggest improvements or add new utilities to enhance the collection.

License

LICENSE