Installation
Via npm or pnpm (global)
# Using npm
# Using pnpm
In a project (package.json)
# Using npm
# Using pnpm
Then add to your package.json scripts:
"scripts":
Via Cargo (Rust)
# Install directly from crates.io
# Or install from source
Binary Installation
You can download pre-compiled binaries from the GitHub Releases page.
Available for:
- Linux (x64, arm64, x86)
- macOS (x64, arm64)
- Windows (x64, x86)
Usage
port-claim -h | --help | -V | --version
port-claim <port> [<additional-ports>] [-v | --verbose]
Options
-h, --help: Prints usage information-V, --version: Prints the version-v, --verbose: Prints verbose information about port status and process killing
Arguments
<port>: Required argument specifying the port to check and kill if in use[<additional-ports>]: Optional additional ports to check and kill
Examples
# Check if port 8080 is in use and kill the process if it is
# Check multiple ports with verbose output
# Display help information
# Display version information
How It Works
- When you specify one or more ports, the tool checks if each port is available.
- If a port is in use, the tool attempts to kill the process using that port.
- With the
--verboseflag, the tool will print information about each step of the process.
Platform Support
The tool works on both Unix-based systems (Linux, macOS) and Windows, using different system commands to identify and kill processes on each platform.
Development
# Clone the repository
# Install dependencies (for the npm wrapper)
# Build the Rust binary
# Run tests
# Format code
# Lint code