Un module simple pour demander l'accord de l'utilisateur dans une CLI.

Overview

Demande de confirmation utilisateur pour CLI


Présentation

ask_lib est un module pour le langage Python proposant une seule fonction; ask(). Le but principal de cette fonction est de proposer un wrapper de la fonction input() pour demander la confirmation de l'utilisateur avant de réaliser une action. ask_lib est donc particulièrement utile pour la création de CLI.

Exemple

import os

from ask_lib import AskResult, ask

reponse = ask("Êtes-vous sûr de vouloir supprimer ce fichier ?", AskResult.YES)
if reponse:
    try:
        os.remove("fichier.txt") # Supprime le fichier | A titre d'exemple
    except Exception:
        print("Quelque chose s'est mal passé...")
    else:
        print("Le fichier vient d'être supprimé.")
else:
    print("Le fichier n'a pas été supprimé.") 

Point de vu de l'utilisateur ;

Êtes-vous sûr de vouloir supprimer ce fichier ? [Y/n] n
Le fichier n'a pas été supprimé.
Êtes-vous sûr de vouloir supprimer ce fichier ? [Y/n] y
Le fichier vient d'être supprimé.

Particularités

  • ask_lib est entièrement documenté avec des docstrings riches et claires.
  • ask_lib est conforme aux principes de SOLID. Le principe de responsabilité unique y est totalement respecté.
  • ask_lib est très simple d'implémentation et d'utilisation.

Prérequis

ask_lib est compatible avec les versions de Python 3 à partir de la version 3.6.

Installation

Vous pouvez installer ask_lib en utilisant pip, avec la commande suivante ;

pip install ask_lib

Documentation

Vous pouvez consulter la documentation en cliquant ICI.
Vous pouvez retrouver ask_lib sur PyPi en cliquant ICI.

Licence

ask_lib est disponible sous licence MIT.

Owner
CallMePixelMan
Tout a commencé avec le Big Bang.. Et puis y'a eu moi.
CallMePixelMan
Darkdump - Search The Deep Web Straight From Your Terminal

Darkdump - Search The Deep Web Straight From Your Terminal About Darkdump Darkdump is a simple script written in Python3.9 in which it allows users to

Josh Schiavone 264 Dec 30, 2022
A CLI tools to get you started on any project in any language

Any Template A faster easier to Quick start any programming project. Installation pip3 install any-template Features No third party dependencies. Tem

Adwaith Rajesh 2 Jan 11, 2022
This is a tool for managing file notes through the command line

This is a tool for managing file notes through the command line

2 Jun 22, 2022
Wordle breaker: A CLI tool to help you solve Wordle

Wordle Breaker A CLI tool to help you solve Wordle I decided to code a solution

Alex 4 Apr 27, 2022
Wappalyzer CLI tool to find Web Technologies

Wappalyzer CLI tool to find Web Technologies

GOKUL A.P 17 Dec 15, 2022
The Prisma Cloud CLI is a command line interface for Prisma Cloud by Palo Alto Networks.

Prisma Cloud CLI The Prisma Cloud CLI is a command line interface for Prisma Cloud by Palo Alto Networks. Support This project has been developed by P

Palo Alto Networks 13 Oct 14, 2022
Konsave lets use save your KDE Plasma customizatios and restore them very easily!

Konsave (Save Plasma Customization) A CLI program that will let you save and apply your KDE Plasma customizations with just one command! Als

439 Jan 02, 2023
Projeto Reverse Shell For Python

Use com sabedoria!!! Modo de uso: Linux (inclui Android e Mac): - apt-get update - apt install python3 (ou "python" apenas) - git clone https://github

1 Jan 03, 2022
A CLI Application to detect plagiarism in Source Code Files.

Plag Description A CLI Application to detect plagiarism in Source Code Files. Features Compare source code files for plagiarism. Extract code features

default=dev 2 Nov 10, 2022
Squirrel - A cli program to track writing progress

Squirrel Very much a WIP project squirrel is a command line program that tracks you writing progress and gives you useful information and cute and pic

3 Mar 23, 2022
⚙ A lightweight command line interface library for creating commands.

⚙ A lightweight command line interface library for creating cli commands. About | Installation | Usage | Features | Contributors | License About Next:

Serum 16 Sep 25, 2022
Splitgraph command line client and python library

Splitgraph Overview Splitgraph is a tool for building, versioning and querying reproducible datasets. It's inspired by Docker and Git, so it feels fam

Splitgraph 313 Dec 24, 2022
Doing set operations on files considered as sets of lines

CLI tool that can be used to do set operations like union on files considering them as a set of lines. Notes It ignores all empty lines with whitespac

Partho 11 Sep 06, 2022
A Hikari command handler for people who love ducks.

duckari A Hikari command handler made with love by ducks. Currently Duckari is work in progress. Documentation is WIP. The wiki is no longer used as d

2 Oct 09, 2022
This a simple tool to query the awesome ippsec.rocks website from your terminal

ippsec-cli This a simple tool to query the awesome ippsec.rocks website from your terminal Installation and usage cd /opt git clone https://github.com

stark0de 5 Nov 26, 2022
Tools hacking termux in the name ant-attack

Hello friends, I am ama.player0000. Web developer, software, Android command line (termux). (1)=Well, ant-attack tool is a tool to attack sites and disable them. (2)=You can use those CCTV servers, s

༺AMA.PLAYER༻ 1 Dec 17, 2021
Fylm is a wonderful automated command line app for organizing your film media.

Overview Fylm is a wonderful automated command line app for organizing your film media. You can pronounce it Film or File 'em, whichever you like! It

Brandon Shelley 30 Dec 05, 2022
Simple and convenient console ToDo list app

How do you handle remembering all that loads of plans you are going to realize everyday? Producing tons of paper notes, plastered all over the house?

3 Aug 03, 2022
CLI tool to computes CO2 emissions of HPC computations following green-algorithms.org methodology

gqueue gqueue is a CLI (command line interface) tool that computes carbon footprint of HPC computations on clusters running slurm. It follows the meth

4 Dec 10, 2021
A Multipurpose bot with many Commands made using Pycord

This repo has all of the commands you will ever need in a discord bot. a Multipurpose discord bot

Pogrammar 42 Dec 18, 2022