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.2.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.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simplifiedcli-1.1.2.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.2.tar.gz
Algorithm Hash digest
SHA256 d8b532624f0f4ca2a3affdee14cf3e32d5db249c584a474c99a39220430a2249
MD5 758228da7430bd2822ce9d5e4471329d
BLAKE2b-256 d9302da1c791180d4e5e6a729586cd1d0351cef7fbbb889cc96a9bb302fb6642

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplifiedcli-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80bfae004cdb38856ab20dd368a5d94444616d96ae3085c157e85d9acd90a033
MD5 b2ce0f254baa72e8c3b9f2878da81581
BLAKE2b-256 bda9a84fa9984f42f71918383acff09e1bd114557be72e996c4f05fe66b257f0

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