bitmask-cli

Crates.iobitmask-cli
lib.rsbitmask-cli
version0.1.0
created_at2025-06-27 19:06:57.37991+00
updated_at2025-06-27 19:06:57.37991+00
descriptionA CLI tool for manipulating individual bits using commands like SET, CLEAR, TOGGLE, CHECK.
homepage
repositoryhttps://github.com/theolodocoder/bitmask-cli
max_upload_size
id1729248
size15,047
prodev (theolodocoder)

documentation

README

๐Ÿงฎ Bitmask CLI

A fast and simple command-line utility for performing bitwise operations (SET, CLEAR, TOGGLE, CHECK) on individual bits of a byte (0โ€“255). Perfect for learning, debugging, or manipulating binary values.

GitHub Crates.io Rust Version


๐Ÿš€ Features

  • โœ… Set, clear, toggle, and check individual bits
  • ๐Ÿ”ข Accepts decimal or binary numbers (u8)
  • ๐Ÿ“ฆ Easily installable via cargo install
  • ๐Ÿ“œ Help command and built-in usage guide
  • ๐Ÿงช Fully tested with unit tests

๐Ÿ“ฆ Installation

From crates.io

cargo install bitmask-cli

Or from GitHub

cargo install --git https://github.com/theolodocoder/bitmask-cli

โš™๏ธ Usage

bitmask-cli --command <COMMAND> --number <NUMBER> --bit-index <INDEX>

Options:

Flag Description
-c, --command Operation: set, clear, toggle, or check
-n, --number A decimal (0โ€“255) byte value
-b, --bit-index Bit index to manipulate (0โ€“7)

๐Ÿ“˜ Examples

bitmask-cli --command set --number 8 --bit-index 3
# Output:
# Original: 00001000 (8)
# Command: Set bit (3)
# Result: 00001000 (8)

bitmask-cli -c toggle -n 8 -b 3
# Result: 00000000 (0)

bitmask-cli -c check -n 8 -b 3
# Bit is set: true

๐Ÿ’ก What Are Bitmasks?

Bitmasking is the technique of using bitwise operations to read or manipulate specific bits in a byte. For example:

  • SET: Turns a bit to 1
  • CLEAR: Turns a bit to 0
  • TOGGLE: Flips a bit from 1 to 0 or 0 to 1
  • CHECK: Checks whether a bit is 1

๐Ÿงช Running Tests

To run tests:

cargo test

๐Ÿค Contributing

Pull requests, bug reports, and ideas are welcome! If you're new to open source, this is a great project to get started with Rust.


๐Ÿ“„ License

This project is licensed under the MIT License. See LICENSE for details.


โœจ Author

Made with โค๏ธ by Your Name

Commit count: 0

cargo fmt