Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

delphi-argparse

Command line argument parser for Delphi.

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

Nullpobug.ArgumentParser

Command line argument parser for Delphi and FPC.

Requirements

  • Delphi 2007 or FPC

License

  • MIT License

Usage

pascal
var
  Parser: TArgumentParser;
  ParseResult: TParseResult;
begin
  Parser := TArgumentParser.Create;
  Parser.AddArgument('--foo', saBool);  // --foo
  Parser.AddArgument('--bar', saStore);  // --bar bar_value
  ParseResult := Parser.ParseArgs;  // if omitted, ParamStr is used.
  // ParseResult := Parser.ParseArgs(ListOfString);
  ParseResult.HasArgument('foo');  // It returns Boolean.
  ParseResult.GetValue('bar');  // It returns String.
end;

Example

Example codes are in "Example" directory.

pascal
>cd delphi-argparse\Example
>make win32
>ArgumentParserExample.exe --foo -b 123 abc def
foo: True
bar: 123
arg1 :abc
arg2 :def