Skip to content

Latest commit

 

History

History
268 lines (209 loc) · 7.96 KB

File metadata and controls

268 lines (209 loc) · 7.96 KB

Windows Command Prompt Utilities

A collection of Windows batch utilities that provide powerful aliases and functions for Git, NPM, and Python development, converted from zsh to Windows command prompt format.

🚀 Features

  • Git Utilities: Complete git workflow aliases and functions
  • NPM Utilities: Package management and testing shortcuts
  • Python Utilities: Environment management and testing tools
  • Cross-directory Support: All utilities work from any directory
  • Windows Native: Optimized for Windows command prompt

📁 Structure

cmd/
├── _bashrc.cmd              # Main configuration file
├── git-utils/               # Git utilities
│   ├── git-update.bat
│   ├── git-status.bat
│   ├── git-restore-all.bat
│   ├── git-checkout.bat
│   ├── git-branch-update-all.bat
│   ├── git-diff-n.bat
│   ├── git-worktree-add.bat
│   ├── git-worktree-checkout.bat
│   ├── git-pull-request.bat
│   ├── test-git-aliases.bat
│   └── README.md
├── npm-utils/               # NPM utilities
│   ├── npm-test-integration.bat
│   ├── npm-test-system-custom.bat
│   ├── npm-test-integration-inband.bat
│   ├── npm-test-system-inband.bat
│   ├── npm-install-build.bat
│   ├── npm-clean-build.bat
│   ├── npm-remove-dist.bat
│   ├── test-npm-aliases.bat
│   └── README.md
├── python-utils/            # Python utilities
│   ├── python-env.bat
│   ├── python-install-requirements.bat
│   ├── python-install-zowe.bat
│   ├── python-test-unit.bat
│   ├── python-test-integration.bat
│   ├── test-python-aliases.bat
│   └── README.md
├── _bashrc.cmd              # Main configuration file
├── _zsh_aliases.sh          # Original zsh aliases (reference)
├── code.cmd                 # VS Code launcher
├── wget.exe                 # Wget for Windows
└── README.md                # This file

🛠️ Installation

Quick Setup

  1. Clone the repository:

    git clone https://github.com/zFernand0/cmd.git
    cd cmd
  2. Load the configuration:

    _bashrc.cmd
  3. Verify installation:

    test-git-aliases
    test-npm-aliases
    test-python-aliases

Auto-load Setup (Recommended)

Method 1: Windows Registry (System-wide)

  1. Open Registry Editor: Press Win+R, type regedit, and press Enter
  2. Navigate to: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
  3. Add/Modify: Create or modify the AutoRun string value
  4. Set Value: C:\path\to\cmd\_bashrc.cmd (replace with your actual path)
  5. Restart: Close and reopen any command prompt windows

Method 2: User-specific Registry

  1. Open Registry Editor: Press Win+R, type regedit, and press Enter
  2. Navigate to: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor
  3. Add/Modify: Create or modify the AutoRun string value
  4. Set Value: C:\path\to\cmd\_bashrc.cmd (replace with your actual path)
  5. Restart: Close and reopen any command prompt windows

Method 3: PowerShell Profile

  1. Create/Edit Profile:
    notepad $PROFILE
  2. Add Line:
    & "C:\path\to\cmd\_bashrc.cmd"
  3. Restart: Close and reopen PowerShell

Manual Setup

  1. Add to your PATH (optional):

    • Add the cmd directory to your system PATH
    • Or run _bashrc.cmd in each new command prompt session
  2. Batch File Shortcut (optional):

    • Create a shortcut to cmd.exe
    • Modify the target to: cmd.exe /k "C:\path\to\cmd\_bashrc.cmd"

📚 Available Commands

This repository provides hundreds of aliases and functions for Git, NPM, and Python development. Here are some key examples:

Git Commands

Basic Operations:

  • ggit (basic git command)
  • gsgit status (with fetch and worktree list)
  • gugit update (fetch and pull)
  • gagit add, gcgit commit

Branch Management:

  • gbgit branch, gbvgit branch -vv
  • gchgit checkout (with fetch)
  • gbU → Update all branches

Push/Pull:

  • gplgit pull, gphgit push
  • gphogit push -u origin

Advanced:

  • gwA → Add worktree with naming
  • gpr → Fetch PR branches
  • gstgit stash, gstagit stash apply

📖 Complete Git Reference: See git-utils/README.md for all 50+ git commands

NPM Commands

Basic Operations:

  • nnpm, ninpm install
  • nrnpm run, nrbnpm run build
  • nrsnpm run start

Testing:

  • ntunpm run test:unit
  • ntinpm run test:integration
  • ntsnpm run test:system

Utilities:

  • nib → Install and build
  • nrcb → Clean and build
  • rmd → Remove dist + git restore

📖 Complete NPM Reference: See npm-utils/README.md for all 30+ npm commands

Python Commands

Basic Operations:

  • p3python3, pyppython3 -m pip
  • pir → Install requirements.txt
  • penv → Environment management

Testing:

  • pytpytest -s
  • tpu → Run unit tests
  • tpi → Run integration tests

📖 Complete Python Reference: See python-utils/README.md for all 15+ python commands

🔧 Configuration

Environment Variables

The _bashrc.cmd file automatically sets up:

  • PATH: Adds utility directories to PATH
  • FNM: Node.js version management (if available)

Customization

You can customize the utilities by:

  1. Modifying batch files in the utility directories
  2. Adding new aliases to _bashrc.cmd
  3. Creating new utility directories for additional tools

🧪 Testing

Run the test scripts to verify all utilities are working:

# Test all utilities
test-git-aliases
test-npm-aliases
test-python-aliases

# Or test individual utilities
git-utils\test-git-aliases.bat
npm-utils\test-npm-aliases.bat
python-utils\test-python-aliases.bat

📖 Usage Examples

Git Workflow

gs          # Check status
ga .        # Stage all changes
gc -m "feat: add new feature"  # Commit
gu          # Update repository
gbU         # Update all branches

NPM Development

ni          # Install dependencies
nrb         # Build project
nrs         # Start development server
ntu         # Run unit tests
nti --watch # Run integration tests in watch mode

Python Development

penv        # Create/activate virtual environment
pir         # Install requirements
pyt         # Run all tests
tpu         # Run unit tests
tpi         # Run integration tests

🔄 Migration from zsh

This project converts zsh aliases to Windows batch format:

  • Original: _zsh_aliases.sh (zsh format)
  • Converted: _bashrc.cmd + utility directories (Windows format)

Key differences:

  • Uses doskey for aliases instead of alias
  • Standalone .bat files instead of shell functions
  • Windows path syntax (\ instead of /)
  • Windows-compatible commands (rmdir instead of rm)

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is open source and available under the Apache License 2.0.

🙏 Acknowledgments

  • Original zsh aliases that inspired this project
  • Windows command prompt community
  • Contributors and users of this utility collection

Made with ❤️ for Windows developers