a list of string arguments that will be processed
A structure with two members. value is the command name remaining is a list of unprocessed arguments
test extractCommandNameArgument usage
/// It returns an empty string on when there are no args assert(extractCommandNameArgument([]).value == ""); assert(extractCommandNameArgument([]).remaining == []); /// It returns the first argument when it does not start with `-` assert(extractCommandNameArgument(["test"]).value == "test"); /// There is nothing to extract when the arguments only contain the `test` cmd assert(extractCommandNameArgument(["test"]).remaining == []); /// It extracts two arguments when they are not a command assert(extractCommandNameArgument(["-a", "-b"]).remaining == ["-a", "-b"]); /// It returns the an empty string when it starts with `-` assert(extractCommandNameArgument(["-test"]).value == ""); // Sub package names are ignored as command names assert(extractCommandNameArgument(["foo:bar"]).value == ""); assert(extractCommandNameArgument([":foo"]).value == "");
Extract the command name from the argument list