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.1.tar.gz (16.5 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.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simplifiedcli-1.1.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.1.tar.gz
Algorithm Hash digest
SHA256 b3768039da9244058942d4989ddf6e659a976918d720eb248de3b6abb4dc80e1
MD5 e4e8171bb0754f60bb14802b317aa57a
BLAKE2b-256 d4d0de07f78f7ceb127eaffd4ac96209a2621d5870d939369e1858f1eb20aca1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplifiedcli-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f97d8a6c711317295e45508181d576f27ec49dba49cbb2e2dd5b4427e522d716
MD5 f58f7394aae7fee1eb69f3379db7b09b
BLAKE2b-256 50a114adaa25bce0d2bdc452d3e5628b19260944dc072b15d3663c84d15518d4

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