Quirky little python package for generating badges for your cli apps
Project description
Getting Started
Installing
As usual, you need to install from PIP:
$ pip install cli-badges
Usage
This is a simple example, using badges to display test results:
from cli_badges import badge
failedBadge = badge("failed",'2',messagebg='red')
skippedBadge = badge('skipped', '1', messagebg='yellow',messagecolor='black')
successBadge = badge('success','8', messagebg='green',messagecolor='black')
print(failedBadge, successBadge, skippedBadge)
The above would output something similar to the terminal:
You could also create a donate badge with a link (if supported):
from cli_badges import badge
donateBadge = badge('❤️ donate', 'ko-fi', messagelink='https://ko-fi.com/logginjs');
print(donateBadge)
You can also only show the label:
from cli_badges import badge
onlyLabel = badge('❤️ donate', '')
print(onlyLabel)
Example output is a mock, console output will vary slightly from terminal to terminal.
Badge Structure
A badge is conformed of a label and a message <label>:<message>
. Each segment can be customized, by changing bg color, text color and style.
Available Options
Option | Value | Default |
---|---|---|
label | String | '' |
message | String | '' |
messagebg | Color | blue |
labelbg | Color | dark_gray |
messagecolor | Color | white |
labelcolor | Color | white |
labelwidth | Integer | label length + 2 |
messagewidth | Integer | label length + 2 |
labelstyles | Array of Styles | [] |
messagestyles | Array of Styles | [] |
labellink | URL | '' |
messagelink | URL | '' |
Colors
cli-badges
uses colored
internally for managing colors, you can check the list of available colors there.
Styles
cli-badges
uses colored
internally for managing styles, you can check the list of available styles there.
Available Styles
- bold
- dim
- underlined
- reverse
- hidden
Links
You can output badges with a link attached to it, that can be clicked in some terminals. labellink
option will add the link to the label, while messagelink
option will add the link to the message.
⚠︎ cli-badges will only output link if its supported by your terminal.
See this for information on supported terminals
badge('with', 'link', labellink='https://link.com', messagelink='https://link2.com');
Other Projects
Contributions are very welcomed 🥰
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cli_badges-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d9a3889984c3d405c850bf3c913da3a4fab1fd17397a12b769f98ab02673c75 |
|
MD5 | 2a93c3536306b9e851753e8a705710f7 |
|
BLAKE2b-256 | 5ccd08ee96d69201eefde19fef763ca5430c8da149a0a9927060d5d57e239097 |