getopt is a concise description of the common POSIX command argument structure, and it is replicated widely by programmers seeking to provide a similar interface, both to themselves and to the user on the command-line. •
C does not ship in the
C standard library, it is called on POSIX systems.
gnulib Alternative interfaces also exist: • The library, used by
RPM package manager, has the additional advantage of being
reentrant. • The family of functions in glibc and gnulib provides some more convenience and modularity. •
C++, if on a POSIX system, can call the same as on C. • library from
Boost offers similar functionality. • from
POCO C++ Libraries have classes Application and OptionSet which support argument parsing. • Google has a library called . •
C# and
.NET Framework: does not have getopt functionality in its
standard library. Third-party implementations are available, such as . •
D has module in the D standard library. •
Go comes with the package, which allows long flag names. The package supports processing closer to the C function. There is also another package providing interface much closer to the original POSIX one. •
Haskell comes with , which is essentially a Haskell port of the GNU getopt library. •
Java has no implementation of getopt in the
Java standard library. Several open source libraries exist, including and the class, which is ported from GNU getopt, and
Apache Commons CLI. •
Lisp has many different dialects with no common standard library. There are some third party implementations of getopt for some dialects of Lisp.
Common Lisp has a prominent third party implementation. •
Free Pascal: has its own implementation as one of its standard units named . It is supported on all platforms. •
Perl programming language has two separate derivatives of getopt in its standard library: and . •
PHP: has a getopt function. •
Python contains a module in its
standard library based on C's getopt and GNU extensions. Python's standard library also contains other modules to parse options that are more convenient to use. •
Ruby has an implementation of in its standard library, . Ruby also has modules in its standard library with a more sophisticated and convenient interface. A third party implementation of the original getopt interface is available. •
Rust has no getopt in the Rust standard library. The library (named for command-line argument parsing) offers similar functionality. == References ==