https://github.com/callmepixelman/ask_lib
Ask user's confirmation from a CLI.
https://github.com/callmepixelman/ask_lib
cli commandline-interface python3
Last synced: about 1 month ago
JSON representation
Ask user's confirmation from a CLI.
- Host: GitHub
- URL: https://github.com/callmepixelman/ask_lib
- Owner: CallMePixelMan
- License: mit
- Created: 2021-07-31T17:35:04.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-18T21:21:56.000Z (over 2 years ago)
- Last Synced: 2025-05-09T21:34:42.640Z (11 months ago)
- Topics: cli, commandline-interface, python3
- Language: Python
- Homepage: https://ask-lib.readthedocs.io/en/latest/?badge=latest
- Size: 215 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README



[](https://github.com/psf/black)
[](https://ask-lib.readthedocs.io/en/latest/?badge=latest)
[](https://github.com/CallMePixelMan/ask_lib/actions/workflows/callmepixelman-workflow.yaml)
# ask_lib
ask_lib is a small Python package available on PyPi that lets you ask user's confirmation from a [CLI](https://en.wikipedia.org/wiki/Command-line_interface).
## Documentation
You can take a look to [the documentation](https://ask-lib.readthedocs.io/en/latest/index.html), hosted by ReadTheDocs.
## Features
- [x] Simple API.
- [x] No dependencies.
- [x] Well tested.
- [x] Featuring CI.
## Install
```sh
pip install ask_lib
# Or, if you are using poetry
poetry add ask_lib
```
## Examples
```py
from ask_lib import ask, AskResult
to_remove = "file.txt"
if ask("Are you sure to delete this file ?", AskResult.NO):
os.remove(to_remove)
```
```py
import os
import sys
from ask_lib import ask, AskResult
yes_to_all = AskFlag.YES_TO_ALL if "-force" in sys.argv else None
to_remove = "file.txt"
if ask("Are you sure to delete this file ?", flag=yes_to_all):
os.remove(to_remove)
```