Skip to main content

Utility function to ask for user's confirmation in a CLI

Project description

Code style: black Documentation Status CallMePixelMan's Workflow

ask_lib

ask_lib is a small Python package available on PyPi that lets you ask user's confirmation from a CLI.

Documentation

You can take a look to the documentation, hosted by ReadTheDocs.

Features

  • Simple API.
  • No dependencies.
  • Well tested.
  • Featuring CI.

Install

pip install ask_lib

# Or, if you are using poetry
poetry add ask_lib

Examples

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)
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)

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

ask_lib-2.0.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

ask_lib-2.0.1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page