# BareCLI
May your CLI code be semantic and your text output beautifully bare.

BareCLI is a slim Python package designed to keep your CLI code semantic
by providing beautiful text output styling. BareCLI features a status sidebar
on the left so an entire execution of a program can be quickly verified at a glance.
BareCLI's API is basically lifted from [Symfony's Command style helpers](https://symfony.com/doc/current/console/style.html).
The aesthetic is inspired by systemd's service log that is displayed
when some Linux distros perform a system shutdown.
## Usage
Install the package with `pip` or `uv`:
```
pip install bare-cli // uv add bare-cli
```
Import the following and construct a BareCLI instance
with an optional accent Color:
```
from bare_cli import BareCLI, Color, InvalidChoiceError
io = BareCLI() # default accent color
io = BareCLI(Color.CYAN) # use desired accent color
```
### Text Output Methods
#### io.title()
Display a title in accent color sandwiched by newlines.
#### io.info()
Display a blue info status sidebar and a main content message.
```
io.info(f"Process finished in {time} ms")
# Outputs the following:
[ INFO ] .. Process finished in 102 ms
```
#### io.success()
Display a green success status sidebar and a main content message.
```
io.success("We did it!")
# Outputs the following:
[ OK ] .... We did it!
```
#### io.error()
Display a red error status sidebar and a main content message.
```
io.error(f"Process failed with error code {code}")
# Outputs the following:
[ ERROR ] . Process failed with error code 422
```
### User Input Methods
All user input method statuses (i.e. the INPUT in the sidebar) are displayed in the accent color.
#### io.ask()
Prompt the user for input. Basically just wraps Python's `input()` function.
```
answer: str = io.ask("How are you?")
```
#### io.confirm()
Prompt the user to answer a boolean question.
The default value can be toggled by using the `permissive_by_default`
kwarg, so the user can just hit the Enter key instead of typing in an answer.
```
answer: bool = io.confirm("Do you like programming?, permissive_by_default=False")
# Outputs the following:
[ INPUT ] . Do you like programming? (yes/no) [no]:
```
#### io.choice()
Prompt the user to choose a value from a list of choices and return a tuple with chosen index and value.
The default behavior for this method is to give the user multiple chances
to choose a valid option and in the case they don't choose one BareCLI will exit the program.
This behavior can be changed by setting the `allow_chances` kwarg to `False` to not allow multiple
chances. Likewise, setting the `exit_early` kwarg to `False` will instead
raise an `InvalidChoiceError` so you can handle how you want.
```
choice: tuple[int, str] = io.choice("What food to do you like?", ["Hot dogs", "Noodes", "Pickles"])
```
Raw data
{
"_id": null,
"home_page": null,
"name": "bare-cli",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "cli, color, colors, terminal, console, ansi, style, styles, text, command-line, formatting",
"author": null,
"author_email": "Jamison Griffith <jamison.griffith@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/63/0d/88a5ee649ea08c23651c0ce046f24e726b2b55a925b9371bda4485d1748a/bare_cli-1.0.1.tar.gz",
"platform": null,
"description": "# BareCLI\n\nMay your CLI code be semantic and your text output beautifully bare.\n\n\nBareCLI is a slim Python package designed to keep your CLI code semantic\nby providing beautiful text output styling. BareCLI features a status sidebar\non the left so an entire execution of a program can be quickly verified at a glance.\n\nBareCLI's API is basically lifted from [Symfony's Command style helpers](https://symfony.com/doc/current/console/style.html).\nThe aesthetic is inspired by systemd's service log that is displayed\nwhen some Linux distros perform a system shutdown.\n\n## Usage\n\nInstall the package with `pip` or `uv`:\n```\npip install bare-cli // uv add bare-cli\n```\n\nImport the following and construct a BareCLI instance\nwith an optional accent Color:\n```\nfrom bare_cli import BareCLI, Color, InvalidChoiceError\n\nio = BareCLI() # default accent color\nio = BareCLI(Color.CYAN) # use desired accent color\n```\n\n### Text Output Methods\n\n#### io.title()\n\nDisplay a title in accent color sandwiched by newlines.\n\n#### io.info()\n\nDisplay a blue info status sidebar and a main content message.\n\n```\nio.info(f\"Process finished in {time} ms\")\n\n# Outputs the following:\n[ INFO ] .. Process finished in 102 ms\n```\n\n#### io.success()\n\nDisplay a green success status sidebar and a main content message.\n\n```\nio.success(\"We did it!\")\n\n# Outputs the following:\n[ OK ] .... We did it!\n```\n\n#### io.error()\n\nDisplay a red error status sidebar and a main content message.\n\n```\nio.error(f\"Process failed with error code {code}\")\n\n# Outputs the following:\n[ ERROR ] . Process failed with error code 422\n```\n\n### User Input Methods\n\nAll user input method statuses (i.e. the INPUT in the sidebar) are displayed in the accent color.\n\n#### io.ask()\n\nPrompt the user for input. Basically just wraps Python's `input()` function.\n\n```\nanswer: str = io.ask(\"How are you?\")\n```\n\n#### io.confirm()\n\nPrompt the user to answer a boolean question.\nThe default value can be toggled by using the `permissive_by_default`\nkwarg, so the user can just hit the Enter key instead of typing in an answer.\n\n```\nanswer: bool = io.confirm(\"Do you like programming?, permissive_by_default=False\")\n\n# Outputs the following:\n[ INPUT ] . Do you like programming? (yes/no) [no]:\n```\n\n#### io.choice()\n\nPrompt the user to choose a value from a list of choices and return a tuple with chosen index and value.\n\nThe default behavior for this method is to give the user multiple chances\nto choose a valid option and in the case they don't choose one BareCLI will exit the program.\nThis behavior can be changed by setting the `allow_chances` kwarg to `False` to not allow multiple\nchances. Likewise, setting the `exit_early` kwarg to `False` will instead\nraise an `InvalidChoiceError` so you can handle how you want.\n\n```\nchoice: tuple[int, str] = io.choice(\"What food to do you like?\", [\"Hot dogs\", \"Noodes\", \"Pickles\"])\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "May your CLI code be semantic and your text output beautifully bare.",
"version": "1.0.1",
"project_urls": {
"Documentation": "https://github.com/jamogriff/bare-cli/blob/main/README.md",
"Homepage": "https://github.com/jamogriff/bare-cli",
"Issues": "https://github.com/jamogriff/bare-cli/issues",
"Source": "https://github.com/jamogriff/bare-cli"
},
"split_keywords": [
"cli",
" color",
" colors",
" terminal",
" console",
" ansi",
" style",
" styles",
" text",
" command-line",
" formatting"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a0f8dfd8eced3fe5e8bd91fb0d6e34d65b91ee00fdc3be62a452626767850ef0",
"md5": "12ffb72b2eaac94e4c2940ae8a665451",
"sha256": "f8352abd2317e5e4c6179f9b02c013274e3ce24a094b17bd886ed2f1c0018c27"
},
"downloads": -1,
"filename": "bare_cli-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "12ffb72b2eaac94e4c2940ae8a665451",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 14346,
"upload_time": "2025-08-31T04:01:33",
"upload_time_iso_8601": "2025-08-31T04:01:33.959119Z",
"url": "https://files.pythonhosted.org/packages/a0/f8/dfd8eced3fe5e8bd91fb0d6e34d65b91ee00fdc3be62a452626767850ef0/bare_cli-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "630d88a5ee649ea08c23651c0ce046f24e726b2b55a925b9371bda4485d1748a",
"md5": "58e9cb7294dd45fdd4b04a20f7451ffe",
"sha256": "0e9e9a2ff3536fb81ef0775d3f40c26c22c3bbc001f3d689088c96330ae53f3b"
},
"downloads": -1,
"filename": "bare_cli-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "58e9cb7294dd45fdd4b04a20f7451ffe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 12760,
"upload_time": "2025-08-31T04:01:35",
"upload_time_iso_8601": "2025-08-31T04:01:35.430213Z",
"url": "https://files.pythonhosted.org/packages/63/0d/88a5ee649ea08c23651c0ce046f24e726b2b55a925b9371bda4485d1748a/bare_cli-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-31 04:01:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jamogriff",
"github_project": "bare-cli",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bare-cli"
}