Skip to main content

A simplified command line interface.

Project description

SimplifiedCLI

A simple CLI for python applications.

Basic Example:

"""Basic example."""

from __future__ import annotations

from typing import TYPE_CHECKING

from simpcli import Manager
from simpcli import get_logger

if TYPE_CHECKING:  # pragma: no cover
    from logging import Logger

    from simpcli import Result

__version__: str = "0.0.1"

logger: Logger = get_logger(__name__)


manager: Manager = Manager(prog=__name__, version=__version__)


@manager.command()
def no_args() -> Result:
    """Command with no arguments."""
    logger.info("no_args")
    return 0


@manager.command()
@manager.parameter("one", type=str)
@manager.parameter("two", type=int)
def positional_args(one: str, two: int) -> Result:
    """Command with positional arguments."""
    logger.info("positional_args %s %s", one, two)
    return 0


@manager.command()
@manager.parameter("param", type=str)
@manager.parameter("-f", "--flag", action="store_true", type=bool)
def optional_args(param: str, flag: bool = False) -> Result:  # noqa: FBT001, FBT002
    """Command with optional arguments."""
    logger.info("flags %s %s", param, flag)
    return 0


if __name__ == "__main__":
    manager.handle_main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simplifiedcli-1.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplifiedcli-1.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file simplifiedcli-1.1.0.tar.gz.

File metadata

  • Download URL: simplifiedcli-1.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for simplifiedcli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 72bf5bad629ba2fb0767e767b16d2623b4c20d7d0d3b3abe7c163eeebff5440e
MD5 5aa94df72dd761df0d3b140a76429d5b
BLAKE2b-256 f0168b99dfe7ad0cd44046f4dbd410ce72ae2dd720f11e61c2efe89774308fc7

See more details on using hashes here.

File details

Details for the file simplifiedcli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: simplifiedcli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for simplifiedcli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7484fe7cafeba2c2f7f370663c92e39c8baaf4d107b965d913dc6906061c2249
MD5 91324f76d1c61d46355d68898e263a8c
BLAKE2b-256 192a037c5cc031d576ce04790ef57ef2682b4330a1b43db39b4042b0ee0b4ba9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page