Skip to main content

A lil' bud that helps you with stuff (it's a utility CLI).

Project description

🌸 Blossy CLI 🌸

A multiuse utility CLI tool developed using:

  • Python
  • Typer (CLI building)
  • Sly Lex Yacc (parsing)

🛠 Features

  • Calculate the value of an expression
  • Count the quantity of characters in a text file
  • Solve percentage equations
  • Generate random numbers
  • Stardardize the names of the files in a directory

🏁 How to Install

To install the CLI, you'll only need to have Python installed on your machine. Then, run the following command:

$ python3 -m pip install blossy

⚙️ Behavior

🧮 Calculate

To calculate the value of an expression, use the calc command. The following operators are supported:

  • (expr)
  • + expr
  • - expr
  • expr ^ expr
  • expr * expr
  • expr / expr
  • expr + expr
  • expr - expr
$ blossy calc "2*3+4^6"
4102

You can use the --visualize flag to see the steps of the calculation, illustrated using postfix notation and a stack.

$ blossy calc "2*3+4^6" --visualize

$                                                          2 3 * 4 6 ^ +₂ $

> Stack 2

$ 2                                                          3 * 4 6 ^ +₂ $

> Stack 3

$ 2 3                                                          * 4 6 ^ +₂ $

> 2 * 3 = 6

$ 6                                                              4 6 ^ +₂ $

> Stack 4

$ 6 4                                                              6 ^ +₂ $

> Stack 6

$ 6 4 6                                                              ^ +₂ $

> 4^6 = 4096

$ 6 4096                                                               +₂ $

> 6 + 4096 = 4102

$ 4102                                                                    $

> The result is 4102

🔢 Count

To count the quantity of characters in a text file, use the calc command.

$ blossy count file.txt 
Character count: 58
Blossy is my favorite puppy.

Did somebody say meatloaf?


You can use the --ignore-unnec flag to ignore unnecessary whitespaces. That way, a sequence of whitespaces will be counted as only one character, and trailing whitespaces will be completely ignored.

$ blossy count file.txt --ignore-unnec
Character count: 55
Blossy is my favorite puppy. Did somebody say meatloaf?

You can also use the --ignore-ws flag to ignore all whitespaces.

$ blossy count file.txt --ignore-ws
Character count: 47
Blossyismyfavoritepuppy.Didsomebodysaymeatloaf?

📊 Percentage

To solve percentage equations, use the perc command. This command uses the formula ratio = part/whole.

$ blossy perc --whole 100 --ratio 0.25
Part: 25.0
$ blossy perc --whole 100 --part 25
Ratio: 0.25

🎲 Random

To generate a random number between two given values (inclusive), use the rand command.

$ blossy rand 1 10
2

You can specify the quantity of random numbers that'll be generated (the default is 1):

$ blossy rand 1 10 --quantity 5
2 7 1 5 1

🗂️ Standardize

To rename the files in a directory, using the format {prefix}-{id}, use the stddz command. Here's an example of how to use the command:

$ blossy stddz my-johnson nice-folder/
nice-folder/
├── my-johnson-000.png
├── my-johnson-001.png
├── my-johnson-002.png
└── my-johnson-003.png

You can use the flag --start to specify the starting number for the IDs:

$ blossy stddz my-johnson nice-folder/ --start 10
nice-folder/
├── my-johnson-010.png
├── my-johnson-011.png
├── my-johnson-012.png
└── my-johnson-013.png

You can also use the flag --digits to specify the quantity of digits that'll be used to represent the IDs (the default is 3):

$ blossy stddz my-johnson nice-folder/ --digits 2
nice-folder/
├── my-johnson-00.png
├── my-johnson-01.png
├── my-johnson-02.png
└── my-johnson-03.png

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

blossy-5.4.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

blossy-5.4-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file blossy-5.4.tar.gz.

File metadata

  • Download URL: blossy-5.4.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for blossy-5.4.tar.gz
Algorithm Hash digest
SHA256 d378e3690e90a18ad89d1672577731d701805d22bf46a88bad092002c223a231
MD5 f8936a4580e6c43987a83e633d28bf22
BLAKE2b-256 fa4c6184a46b8e6e1551c62b2787d93b3615585d94a0ddcabf48ab3a0894da72

See more details on using hashes here.

File details

Details for the file blossy-5.4-py3-none-any.whl.

File metadata

  • Download URL: blossy-5.4-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for blossy-5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3e18aff70c513882ccda699e5eb05a0239c02daa85e678c05cb638f102a7f616
MD5 1823c826fa89c57583e7d2473177c87f
BLAKE2b-256 3d1c875f0a86c6d06f1aab480fa5ee628c4e5a9aad9330637111e767705cf747

See more details on using hashes here.

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