ezqrcli


Nameezqrcli JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/DJStompZone/ezqrcli.git
SummaryThe easy command line QR code generator
upload_time2024-11-13 03:23:38
maintainerNone
docs_urlNone
authorDJ Stomp
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # EZQRCLI

The easy QR code command-line interface

## Overview

EZQRCLI is a command-line tool for generating and displaying QR codes in the terminal. It allows you to encode URLs into QR codes and display them with optional text above and below the QR code.

## Installation

To install EZQRCLI, you need to have Python 3.10 or higher. You can install the required dependencies using `pip`:

```sh
pip install ezqrcli
```

## Usage

You can use EZQRCLI from the command line to generate and display QR codes. Below are the available command-line options:

```sh
usage: ezqrcli [-h] [-t TOP_TEXT] [-b BOTTOM_TEXT] [-w CENTER_WEIGHT] url

Generate and display a QR code in the terminal with optional text.

positional arguments:
  url                   The URL to encode in the QR code.

optional arguments:
  -h, --help            show this help message and exit
  -t TOP_TEXT, --top-text TOP_TEXT
                        Text to display above the QR code. Defaults to "Scan this QR code:".
  -b BOTTOM_TEXT, --bottom-text BOTTOM_TEXT
                        Text to display below the QR code. Defaults to the URL, truncated to 50 chars.
  -w CENTER_WEIGHT, --center-weight CENTER_WEIGHT
                        Weight to adjust the centering of the QR code. Default is 1.0.
```

Example usage:

```sh
python -m ezqrcli "https://example.com" -t "Welcome!" -b "Scan to visit example.com"
```

## Code Structure

### `QRCLI` Class

The `QRCLI` class is responsible for generating and displaying QR codes in the terminal. It has the following attributes and methods:

#### Attributes

- `url` (str): The URL to encode in the QR code.
- `top_text` (str): Text to display above the QR code. Default is "Scan this QR code:".
- `bottom_text` (str): Text to display below the QR code. Defaults to the first 50 chars of the URL.
- `center_weight` (float): Weight to adjust the centering of the QR code. Default is 1.0.
- `maxwidth` (int): Maximum width of the QR code.
- `_raw_qr` (str): Raw QR code data.
- `qr_text` (str): Processed QR code text.
- `formatted_qr` (str): Formatted QR code with padding and text.
- `padding` (str): Padding to center the QR code vertically.
- `width` (int): Width of the terminal.
- `height` (int): Height of the terminal.
- `centered_qr_text` (str): Centered QR code text.
- `_raw_lines` (list): List of raw QR code lines.
- `qrcode` (module): QR code module.

#### Methods

- `ensure_qrcode()`: Static method to install the `qrcode` module.
- `_ensure_qrcode()`: Attempts to import the `qrcode` module, installs it if not found.
- `_update()`: Updates the QR code and its attributes.
- `_get_padding() -> str`: Calculates the padding to center the QR code vertically.
- `_get_width() -> int`: Calculates the width of the terminal.
- `_get_height() -> int`: Calculates the height of the terminal.
- `_generate_qr()`: Generates the QR code from the URL.
- `_process_qr()`: Processes the raw QR code to center its lines.
- `_center_qr() -> str`: Centers the QR code text and adds top and bottom text.
- `_format_qr()`: Formats the QR code with padding and text.
- `get_formatted_qr() -> str`: Returns the formatted QR code.
- `get_raw_qr() -> str`: Returns the raw QR code.
- `display_qr()`: Displays the formatted QR code in the terminal.

### `ensure_qrcode` Function

The `ensure_qrcode` function in `ezqrcli/util.py` ensures that the `qrcode` package is installed and available for import. If the module is not found, it installs it using pip.

## Testing

To run the tests, use the following command:

```sh
pytest
```

The tests are located in the `tests` directory and cover various aspects of the `QRCLI` class.

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DJStompZone/ezqrcli.git",
    "name": "ezqrcli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "DJ Stomp",
    "author_email": "85457381+DJStompZone@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/f5/67/52f3e2e1fbe783eb3ccfce7dfbfa528e090dafc84c5f05236754d0a735db/ezqrcli-1.0.2.tar.gz",
    "platform": null,
    "description": "# EZQRCLI\n\nThe easy QR code command-line interface\n\n## Overview\n\nEZQRCLI is a command-line tool for generating and displaying QR codes in the terminal. It allows you to encode URLs into QR codes and display them with optional text above and below the QR code.\n\n## Installation\n\nTo install EZQRCLI, you need to have Python 3.10 or higher. You can install the required dependencies using `pip`:\n\n```sh\npip install ezqrcli\n```\n\n## Usage\n\nYou can use EZQRCLI from the command line to generate and display QR codes. Below are the available command-line options:\n\n```sh\nusage: ezqrcli [-h] [-t TOP_TEXT] [-b BOTTOM_TEXT] [-w CENTER_WEIGHT] url\n\nGenerate and display a QR code in the terminal with optional text.\n\npositional arguments:\n  url                   The URL to encode in the QR code.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t TOP_TEXT, --top-text TOP_TEXT\n                        Text to display above the QR code. Defaults to \"Scan this QR code:\".\n  -b BOTTOM_TEXT, --bottom-text BOTTOM_TEXT\n                        Text to display below the QR code. Defaults to the URL, truncated to 50 chars.\n  -w CENTER_WEIGHT, --center-weight CENTER_WEIGHT\n                        Weight to adjust the centering of the QR code. Default is 1.0.\n```\n\nExample usage:\n\n```sh\npython -m ezqrcli \"https://example.com\" -t \"Welcome!\" -b \"Scan to visit example.com\"\n```\n\n## Code Structure\n\n### `QRCLI` Class\n\nThe `QRCLI` class is responsible for generating and displaying QR codes in the terminal. It has the following attributes and methods:\n\n#### Attributes\n\n- `url` (str): The URL to encode in the QR code.\n- `top_text` (str): Text to display above the QR code. Default is \"Scan this QR code:\".\n- `bottom_text` (str): Text to display below the QR code. Defaults to the first 50 chars of the URL.\n- `center_weight` (float): Weight to adjust the centering of the QR code. Default is 1.0.\n- `maxwidth` (int): Maximum width of the QR code.\n- `_raw_qr` (str): Raw QR code data.\n- `qr_text` (str): Processed QR code text.\n- `formatted_qr` (str): Formatted QR code with padding and text.\n- `padding` (str): Padding to center the QR code vertically.\n- `width` (int): Width of the terminal.\n- `height` (int): Height of the terminal.\n- `centered_qr_text` (str): Centered QR code text.\n- `_raw_lines` (list): List of raw QR code lines.\n- `qrcode` (module): QR code module.\n\n#### Methods\n\n- `ensure_qrcode()`: Static method to install the `qrcode` module.\n- `_ensure_qrcode()`: Attempts to import the `qrcode` module, installs it if not found.\n- `_update()`: Updates the QR code and its attributes.\n- `_get_padding() -> str`: Calculates the padding to center the QR code vertically.\n- `_get_width() -> int`: Calculates the width of the terminal.\n- `_get_height() -> int`: Calculates the height of the terminal.\n- `_generate_qr()`: Generates the QR code from the URL.\n- `_process_qr()`: Processes the raw QR code to center its lines.\n- `_center_qr() -> str`: Centers the QR code text and adds top and bottom text.\n- `_format_qr()`: Formats the QR code with padding and text.\n- `get_formatted_qr() -> str`: Returns the formatted QR code.\n- `get_raw_qr() -> str`: Returns the raw QR code.\n- `display_qr()`: Displays the formatted QR code in the terminal.\n\n### `ensure_qrcode` Function\n\nThe `ensure_qrcode` function in `ezqrcli/util.py` ensures that the `qrcode` package is installed and available for import. If the module is not found, it installs it using pip.\n\n## Testing\n\nTo run the tests, use the following command:\n\n```sh\npytest\n```\n\nThe tests are located in the `tests` directory and cover various aspects of the `QRCLI` class.\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The easy command line QR code generator",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/DJStompZone/ezqrcli.git",
        "Repository": "https://github.com/DJStompZone/ezqrcli.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "427233699014bcb956de1741ae78a3ed1a03ff7cd035fb4ee40e26100c6d294d",
                "md5": "544038c869848b4523fbe74209d3fdfb",
                "sha256": "4ef0fc094a1c30ca514d3bcd5f910aa7d9fdcf862cb4fd916b9d82cf10baac83"
            },
            "downloads": -1,
            "filename": "ezqrcli-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "544038c869848b4523fbe74209d3fdfb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 7150,
            "upload_time": "2024-11-13T03:23:37",
            "upload_time_iso_8601": "2024-11-13T03:23:37.048849Z",
            "url": "https://files.pythonhosted.org/packages/42/72/33699014bcb956de1741ae78a3ed1a03ff7cd035fb4ee40e26100c6d294d/ezqrcli-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f56752f3e2e1fbe783eb3ccfce7dfbfa528e090dafc84c5f05236754d0a735db",
                "md5": "d2bfb04345b9a78a1bed03f6e11873d6",
                "sha256": "bbdae9b8f8084708cc791555c24f7fa9a8250a5f569429d116b487be7bbc9631"
            },
            "downloads": -1,
            "filename": "ezqrcli-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d2bfb04345b9a78a1bed03f6e11873d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 5695,
            "upload_time": "2024-11-13T03:23:38",
            "upload_time_iso_8601": "2024-11-13T03:23:38.506200Z",
            "url": "https://files.pythonhosted.org/packages/f5/67/52f3e2e1fbe783eb3ccfce7dfbfa528e090dafc84c5f05236754d0a735db/ezqrcli-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-13 03:23:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DJStompZone",
    "github_project": "ezqrcli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ezqrcli"
}
        
Elapsed time: 0.33134s