Jump to content

Talk:Command-line argument parsing

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Widefox (talk | contribs) at 14:40, 2 August 2020 (Assessment (List): Computer science, Computing (Rater)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputer science: Computing List‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
ListThis article has been rated as List-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Computing (assessed as Low-importance).
Things you can help WikiProject Computer science with:

WikiProject iconComputing: Software List‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
ListThis article has been rated as List-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software (assessed as Low-importance).

Title of this article confusing

Reading about "parsing" I expected to read something about parsing command line arguments, probably in different programming languages, for example pointers to libraries that simplify this task for the most common conventions for the syntax of command lines. However, this article seems only to show how to access and iterate through the command line in different programming language. So at this point in time a less confusing title probably was "Command-line argument processing". — Preceding unsigned comment added by Pia F. Bichsel (talkcontribs) 10:18, 27 January 2016 (UTC)[reply]

Why this article doesn't make much sense and should either be reworked completely or deleted

  • The overall method used to parse command-line arguments is not a question of any particular programming language. For example, if you want your program to parse command-line arguments in a POSIX-compliant way, then the parser needs to do what POSIX specifies, regardless of the language it is written in. The language-specific part is merely how to accomplish what the specification says in $language.
  • In the examples for C, Bash, Perl and Python, there is exactly zero parsing going on. Parsing means syntactical analysis, not merely printing back user input. The example for Bash doesn't offer anything but an example of how user input should not be handled (unquoted substitutions), which is why I will remove it in a minute. If you want to know something about parsing command-line arguments in Bash, see, for example: https://mywiki.wooledge.org/BashFAQ/035.

For a sane approach to saying something about parsing command-line arguments in general, you could have a look at something I have written about that topic recently: https://www.msiism.org/blog/2019/03/10/how-to-parse-command-line-arguments.html (Note that the article is not published under a free content license.) Msiism (talk) 20:37, 13 March 2019 (UTC)[reply]