Skip to content

A command-line interface (CLI) tool that allows users to generate QR codes by providing text or URLs as input.

License

Notifications You must be signed in to change notification settings

A2va/dai-qr-code

Repository files navigation

Pratical work 1 DAI - QR Code Generator

This project has been made in the context of DAI courses at HEIG-VD

Authors

      █████████████████████████████████        █████████████████████████████████
      █████████████████████████████████        █████████████████████████████████
      ████ ▄▄▄▄▄ █▀▄█▀ ▄█ ▀█ ▄▄▄▄▄ ████        ████ ▄▄▄▄▄ █▀▄█▀  ▄ ▄█ ▄▄▄▄▄ ████
      ████ █   █ █▄   ▄ ▀ ▀█ █   █ ████        ████ █   █ █▄   ▄▀ ▀▀█ █   █ ████
      ████ █▄▄▄█ █ ▀█▀██▄ ▀█ █▄▄▄█ ████        ████ █▄▄▄█ █ ▀█▀█▄▀███ █▄▄▄█ ████
      ████▄▄▄▄▄▄▄█ ▀▄█ █ █▄█▄▄▄▄▄▄▄████        ████▄▄▄▄▄▄▄█ ▀▄█ █▄▀▄█▄▄▄▄▄▄▄████
      ████▄ █▄██▄▄▀█ ▀█▀▀  ▀▄▄▄█▄ ▀████        ████▄▄█ ██▄▄██ ▀█▄█▀▀▀▄▄▄█▄ ▀████
      ████ █▀▄  ▄▄ ▄▄██▀ █▀  █ ▄█▄ ████        ████▀▄▀ ▀█▄  ▄▄██▄█ ▀  █ ▄█▄ ████
      ████▄▄▄█▀ ▄▀▄█▀▀ █▄ ▀█▀ ▄█ ▀▀████        ████▄ ▄▄▀▀▄▀ █▀▀ █▄▀▀█▀ ▄█ ▀▀████
      ████▄▀▄▀▀█▄▀▀▀▄█ ▀██▄█ ▄█▀█▄█████        ████▄▀  ▀▀▄ ▀  █ ▀█▀▀█ ▄█▀█▄█████
      ████▄▄▄▄██▄▄▀▄▄▄█▄ █ ▄▄▄ ▄ ▀ ████        ████▄▄█▄██▄▄ █ ▄█▄ ▄ ▄▄▄ ▄ ▀ ████
      ████ ▄▄▄▄▄ █▄ ▀▀█ █  █▄█ ▄▄▀▀████        ████ ▄▄▄▄▄ █▄▄ ▀█ █  █▄█ ▄▄▀▀████
      ████ █   █ █▀▀█  ▀▄█ ▄▄   ▄▀█████        ████ █   █ █▀ ▀  ▀▄█ ▄▄   ▄▀█████
      ████ █▄▄▄█ █▀▄▀   ▄  ▀▄ ██ █ ████        ████ █▄▄▄█ █▀█    ▄  ▀▄ ██ █ ████
      ████▄▄▄▄▄▄▄█▄▄▄▄██▄▄██▄█▄███▄████        ████▄▄▄▄▄▄▄█▄▄█▄██▄▄██▄█▄███▄████
      █████████████████████████████████        █████████████████████████████████
      █████████████████████████████████        █████████████████████████████████
           Antoine Leresche (A2va)                Robin Forestier (Forestierr)  

Description

A command-line interface (CLI) tool that allows users to generate QR codes by providing text or URLs as input.

Features:

  • Create QR codes from text / url / file / ...
  • Display the QR in the terminal (ascii art)
  • Save in a file (ascii art)
  • Save as image
  • Change size / shape / encoding

Installation

Start by cloning the repository:

git clone https://github.com/A2va/dai-qr-code.git

Then, you can compile the project into a JAR located into the target folder:

./mvnw package

Usage

When running qrcode with the help option, you can have a full description on all other options:

a2va@linux:~$ java -jar target/qrcode-1.0-SNAPSHOT.jar --help
Usage: qrcode-1.0-SNAPSHOT.jar [-hsV] [-if=<inputFormat>] [-o=<outputFilePath>
                               [-of=<outputFormat>] [-f]] <text>
A command line interface (CLI) tool that allows users to generate QR codes by
providing text or URLs as input.
      <text>      The text or file to be encoded as a QR code.
  -f, --force     Don't prompt to overwrite if file exists.
  -h, --help      Show this help message and exit.
      -if, --input-format=<inputFormat>
                  Input format, default text (possible format: text, file)
  -o, --output=<outputFilePath>
                  The path to the output file.
      -of, --output-format=<outputFormat>
                  The output format, (possible format: text, jpeg)
  -s, --show      Force the display of the QR code in the terminal if the
                    output is a file, by default the QR code is displayed if no
                    output is provided.
  -V, --version   Print version information and exit.

Here is the most basic usage of the program (java -jar has been removed for better readability)

a2va@linux:~$ qrcode "https://example.com/generate-qr-from-url"

By default, the QR code is displayed in the terminal below your command. You can also output the code to a text file or a binary image file (like jpeg), this can be done by:

a2va@linux:~$ qrcode --output-format=JPEG -o "output.jpg" "https://example.com/generate-qr-from-url"

Finally, the text to be encoded in the QR code can be taken from an existing file, in this mode it also reads any text line by line, you can do it with:

a2va@linux:~$ qrcode --input-format=file -i input.txt --output-format=JPEG -o "output.jpg"

The above command creates as many images as there are lines in the input file. The file will be named output.jpg, output1.jpg, output2.jpg and so on.

About

A command-line interface (CLI) tool that allows users to generate QR codes by providing text or URLs as input.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages