Designing a beautiful and lovely command line interfaceAfuwa MusaBlockedUnblockFollowFollowingMar 5A command-line interface or command language interpreter (CLI), also known as a command-line user interface, console user interface and character user interface (CUI), this is a way or means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text.
Command-line applications, also referred to as Console Applications, are computer programs designed to be used from a text interface, such as a shell.
Command-line applications usually accept various inputs as arguments often referred to as parameters or sub-commands, as well as options.
Command-line applications, also referred to as Console Applications, these are computer programs designed to be used from a text interface, such as a shell Command-line applications usually accept various inputs as arguments often referred to as parameters or sub-commands, as well as options.
In my command line, I used click to design my interface though there are still various ways of designing an interface in a command line.
click is one of the easiest ways of designing a command line interface.
click is a Python package for creating command-line interfaces in a composable way with as little code as possible.
It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API.
I see click as the simplest because there is not a single command line utility for Python out there which ticks the following:supports file handling out of the boxit follows the unisex command line inventionsit is fully nestable and composableEither python 2 or three, it works the sameSupports loading values from environment variables out of the boxIt is lazily composable without restrictionsHow I created a command line application that consumes the News API using python.
since am using windows, all the commands used here are supported on windows platform and in this case, for those that are using other operating systems, just follow the manual of your operating systems.
Pip (Python Package Installer), official documentation for pip.
Usually, Python3 comes with pip preinstalled.
If you get an error “pip command not found”, use the following command to install pip:Download get-pip.
py, make sure you save the file to DesktopIn your command prompt, navigate to DesktopThe virtual environment is probably what you want to use for developing Click applications.
We install virtual environment in our working folder using the command.
Hence whichever package that you want to install in your command line, pip always comes first because it’s the path.
After installing the virtualenv, that’s when click will be installed and then install requests just as we saw that pip comes first then your order it to install anything you want.
importing click and requestsAfter importing click and requests, there I started writing my cord where I used classes and methods and then designed my interface and below is the output.
thats my output.. More details