This program demonstrates how to find the value of a command-line flag. Running this program as follows should print 'foo=bar' without quotes:
fpm run --example get-command-line-flag-value -- --foo bar
Running the above command either without bar
or without "--foo bar" should print an indication the message "flag '--foo' not present or present with no value".
was provided.
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
type(command_line_t) | :: | command_line | ||||
character(len=:), | allocatable | :: | foo_value |