This application is a ports manager, for registering an application name and getting the next available port. The port range is 8000-9000.
- go 1.23.0 or above
- make (if you want to use the
Makefile
provided)
porty
is available on Linux, macOS and Windows platforms.
Binaries for Linux, Windows and Mac are available as tarballs in the release page.
Install to the Go bin
directory e.g. $HOME/go/bin/
.
go install github.com/softwarespot/porty@latest
Initialize the ports database.
# As text
porty init
# As JSON
porty init --json
Get or assign the next available port number for the app name.
# As text
porty get myapp
# As JSON
porty get myapp --json
List all port numbers.
# As text
porty list
# As JSON
porty list --json
Get the next available port number, without assigning to an app name.
# As text
porty next
# As JSON
porty next --json
Remove a port number for the app name.
# As text
porty remove myapp
# As JSON
porty remove myapp --json
Get who has been assigned to a port number.
# As text
porty who 8001
# As JSON
porty who 8001 --json
Display the version of the application.
# As text
porty version
# As JSON
porty version --text
Display the help text and exit.
porty --help
Adds autocompletion for the application's commands.
Add the following line to the .bashrc
file; otherwise, refer to kubectl's documentation about locations for other OSs
- For
bash
source <(porty completion bash)
- For
fish
source <(porty completion fish)
- For
zsh
source <(porty completion zsh)
Example of adding autocompletion for bash
to the .bashrc
file.
echo 'source <(porty completion bash)' >> ~/.bashrc
source ~/.bashrc
IMPORTANT: 3rd party dependencies are used.
I only ever use dependencies when it's say an adapter for an external service e.g. Redis, MySQL or Prometheus.
Docker
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:latest golangci-lint run -v --tests=false --disable-all -E durationcheck,errorlint,exhaustive,gocritic,gosimple,ineffassign,misspell,predeclared,revive,staticcheck,unparam,unused,whitespace --max-issues-per-linter=10000 --max-same-issues=10000
Local
golangci-lint run --tests=false --disable-all -E durationcheck,errorlint,exhaustive,gocritic,gosimple,ineffassign,misspell,predeclared,revive,staticcheck,unparam,unused,whitespace --max-issues-per-linter=10000 --max-same-issues=10000
The code has been licensed under the MIT license.