Skip to main content

Building Block View

↑ Go to Level 1

Level 2: CLI (Whitebox)​

Level 2: CLI

Purpose / Responsibility​

The command line interface (CLI) is based on the Kotlin CLI parser kotlinx-cli, aiming to bring watermarking functionalities into the terminal. It is able to embed and extract watermarks from Strings directly in the terminal and files. The CLI tool is easy to extend with custom commands and arguments. Under the hood, it uses the Innamark watermark library with the Java build target as Gradle dependency.

Expansion​

To expand upon the CLI tool's current functionality you will have to:

  • Create a new kotlinx.cli.Subcommand class for argument parsing within the cli function.
  • Create a new function for the new actions that can be called by the subcommand class's execute override function.
  • For top-Level commands (like Add, Text, Remove):
    • Add the new subcommand class to the parser.subcommands list within the cli function.
  • For lower-Level commands (like TextAdd, TextList, TextRemove):
    • Register the new subcommand to the parent subcommand class using the init block and this. subcommands.

Contained Blackboxes​

Building BlockDescription
MainThe Main file contains the full logic of the CLI tool, like parsing CLI arguments and executing them.
Watermarker LibraryA Kotlin multiplatform library, offering watermark embedding and extraction functionalities, integrated as external Gradle dependency with the JVM build target.
kotlinx-cliA generic command-line parser for Kotlin, integrated as external Gradle dependency.