X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=cli-helper.git;a=blobdiff_plain;f=doc%2FCLI%20arguments%20processing.org;fp=doc%2FCLI%20arguments%20processing.org;h=c385fcb60e03f308f57baa81b809f5a7ed2b1416;hp=2a38bee93ccb0978e7c79ee77a05efdfb73b0b8b;hb=324ea20c0c65f671c0d35e94ed90142912a56b4c;hpb=2c29a140b3ff6f0f60ac838437c4bd9b8fd6dad7 diff --git a/doc/CLI arguments processing.org b/doc/CLI arguments processing.org index 2a38bee..c385fcb 100644 --- a/doc/CLI arguments processing.org +++ b/doc/CLI arguments processing.org @@ -7,8 +7,8 @@ - [[id:bb4f96cd-458c-495b-a605-313b2e3e28d2][Back to CLI Helper - library main page]] -* Theory -** Commands and Arguments +* Terminology +** 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 @@ -34,16 +34,17 @@ down our example command: | 2 | --input | [[id:ffedf388-4d23-41eb-98d0-83fd3940b24d][option1]] | | 3, 4, 5 | vid1.mp4 vid2.mp4 vid3.mp4 | [[id:8a39d20c-421f-4bc7-94e4-8e561e58bea0][parameters for --input option]] | | 6 | --quality | [[id:ffedf388-4d23-41eb-98d0-83fd3940b24d][option2]] | -| 7 | 5 | [[id:8a39d20c-421f-4bc7-94e4-8e561e58bea0][option for --quaily option]] | +| 7 | 5 | [[id:8a39d20c-421f-4bc7-94e4-8e561e58bea0][parameter for --quaily option]] | ** Subcommand :PROPERTIES: :ID: 94242e8a-c59b-42fd-8cc7-ba3df1938119 :END: -Subcommands are more specific actions 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*. +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*. ** Option :PROPERTIES: @@ -66,29 +67,3 @@ 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. - -* Implementation :noexport: - -Parsing Command-line Arguments: -- `Parameter` class is used for defining parameters with their - descriptions, types, and aliases. It also keeps track of whether the - specific option was present in the command line or not. This - information is used later in the processing. - - - `DirectoryParameter`, `FileParameter`, `IntegerParameter`, - `StringParameter`, `NullParameter`, and `StringParameters` are - examples of Parameter classes, each one having unique - characteristics for handling specific types of parameters - (directories, files, integers, strings, etc.). - -- `ArgumentCount` class determines if a option can have any amount - of arguments (MULTI), exactly one argument (SINGLE), or no arguments - (NONE). - -- `Parser` class takes all these parameters and checks whether all - required arguments are provided and if they match the expected - format. - -** Usage example - -TODO: