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

import logging
from typing import TYPE_CHECKING

from simpcli import Manager

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

    from simpcli import Result

__version__: str = "0.0.1"

logger: Logger = logging.getLogger()

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.2.0.tar.gz (15.8 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.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simplifiedcli-1.2.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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.2.0.tar.gz
Algorithm Hash digest
SHA256 e02bd1b64ce6e7895b424209c513a5db16c0ff6b16bfcdbf4ec8a1b7fa0f5bfb
MD5 14698c117e9968486aea23e164eaa411
BLAKE2b-256 3233b7cdf971a19cb71b5e3800bf37fe755b1c5866bdc91fdf1800d349baaebe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplifiedcli-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9e6145215a861639bc005d9ed56e5fdeabae1934ed4f0870561968097b9cc5e
MD5 623080da7949d3ddf04ad12023858d93
BLAKE2b-256 ca3aa1e02aecefdb77fda4534961a1063c11e835cd541a29172b87151d9b2f94

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