Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

path-and-address

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-and-address

Functions for server command-line arguments used by humans.

  • 2.0.1
  • PyPI
  • Socket score

Maintainers
1

Path-and-Address

Functions for command-line server tools used by humans.

Description

Path-and-address resolves ambiguities for command-line interface applications with the following pattern:

$ your_app [<path>] [<address>]

The library applies the principal of least surprise to command-line interfaces.

Some examples:

$ your_app .
 * Serving . on http://localhost:5000/

$ your_app 80
 * Serving . on http://localhost:80/

$ your_app ./80
 * Serving ./80 on http://localhost:5000/

$ your_app path/to/file
 * Serving path/to/file on http://localhost:5000/

$ your_app 0.0.0.0
 * Serving 0.0.0.0 on http://localhost:5000/

$ your_app . 0.0.0.0
 * Serving . on http://0.0.0.0:5000/

$ your_app 0.0.0.0:8080
 * Serving . on http://0.0.0.0:8080/

Usage

Implement a CLI front-end in Python that exposes the above [path] [address] pattern. Then call resolve(path, address).

Example, using sys.argv directly:

import sys
from path_and_pattern import resolve

path, address = resolve(*argv[1:])

More examples can be found in the "examples" directory.

Installation

To install, simply:

$ pip install path-and-address

Or put it in your project's requirements.txt.

Contributing

  1. Check the open issues or open a new issue to start a discussion around your feature idea or the bug you found
  2. Fork the repository, make your changes, and add yourself to Authors.md
  3. Send a pull request

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc