X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=cli-helper.git;a=blobdiff_plain;f=doc%2FCLI%20arguments%20processing.html;fp=doc%2FCLI%20arguments%20processing.html;h=30814c6b9476c4ce9228fa8563ee6b1cdc6e2e8f;hp=0000000000000000000000000000000000000000;hb=324ea20c0c65f671c0d35e94ed90142912a56b4c;hpb=2c29a140b3ff6f0f60ac838437c4bd9b8fd6dad7 diff --git a/doc/CLI arguments processing.html b/doc/CLI arguments processing.html new file mode 100644 index 0000000..30814c6 --- /dev/null +++ b/doc/CLI arguments processing.html @@ -0,0 +1,358 @@ + + + + + + + +Commandline interface arguments processing + + + + + + +
+

Commandline interface arguments processing

+
+

Table of Contents

+ +
+ + +
+

1. Terminology

+
+
+
+

1.1. Command and argument

+
+

+Every command-line application has a way of receiving input from +users, usually in the form of command-line arguments. A command-line +argument is a piece of information provided to the command-line +application when it's invoked. These arguments are provided as an +array of strings. The first element of the array (argument 0) is +typically the name of the command itself. +

+ +

+In the example below, 'my-video-coder' is our command, and the rest +are arguments: +

+ +
+
my-video-coder encode --input vid1.mp4 vid2.mp4 vid3.mp4 --quality 5
+
+
+ +

+To better understand how these concepts work together, let's break +down our example command: +

+ + + + +++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
argument #value(s)type
0my-video-codercommand
1encodesubcommand
2–inputoption1
3, 4, 5vid1.mp4 vid2.mp4 vid3.mp4parameters for –input option
6–qualityoption2
75parameter for –quaily option
+
+
+ +
+

1.2. Subcommand

+
+

+Subcommands are arguments that invoke more specific action that a +command can perform. They are often used with commands that have +multiple functions. In our example, encode is a subcommand of +my-video-coder. +

+
+
+ +
+

1.3. Option

+
+

+Options are arguments that change the behavior of a command or +subcommand. They usually start with a dash (-) or double dash +(–). For instance, –input and –quality are options in our +example command. +

+
+
+ +
+

1.4. Parameter

+
+

+Parameter provides additional information to a command, subcommand or +option. +

+ +

+For instance, in our example: +

+
    +
  • 'vid1.mp4 vid2.mp4 vid3.mp4' are parameters for the –input option.
  • +
  • '5' is a parameter for the –quality option.
  • +
+
+
+
+
+
+

Author: Svjatoslav Agejenko

+

Created: 2023-10-12 Thu 23:05

+

Validate

+
+ +