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.0.0.tar.gz
(16.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplifiedcli-1.0.0.tar.gz.
File metadata
- Download URL: simplifiedcli-1.0.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73efa403c26b11e58005a1a9154f10f7d250c777ea0235dabbe1d2689036810b
|
|
| MD5 |
0eee757cddd4a5464133f5e5b8b59061
|
|
| BLAKE2b-256 |
3a12e0094a61891e2a4ea59daae603ed44ab2a2222c279326c3bdad37d84c4f6
|
File details
Details for the file simplifiedcli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: simplifiedcli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3065df57ddd094c23a0ca779e32563e4c9b1e84f6da48ce10924a7e67c77145
|
|
| MD5 |
bf94df3c9a045418ae9177cd030d15dc
|
|
| BLAKE2b-256 |
888446962d786e6870624a56cab22b3539663969fa4adac0c09a0fcd169f565d
|