portfor

command module
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 7 Imported by: 0

README

Portfor Go Reference

The problem

You develop a lot of sites on your computer and can never remember if a particular site is on port 3000, 3001, 8000, 8080, etc. etc.

The solution

Portfor returns a deterministic hash for a given argument suitable for use as an unpriviledged port number. As a special case, it trims www. or local. prefixes from its argument.

Usage

$ portfor example.com
24250

$ portfor www.example.com
24250

$ portfor -h
portfor v0.21.1

portfor returns a deterministic hash for a given argument suitable for use as an
unpriviledged port number. As a special case, it trims "www." or "local." prefixes
from its argument.

Options:

  -l    output localhost address (change string format with $PORTFOR_LOCALHOST)

$ PORT=$(portfor example.com) run-dev-server.sh
# server starts up on port 24250

$ another-run-script.sh -p $(portfor example.com)
# server starts up on port 24250

$ open $(portfor -l example.com)
# web browser opens to http://localhost:24250

Installation

Requires Go to be installed.

$ go install github.com/carlmjohnson/portfor@latest

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL