Methods

~ΒΆ

~(argv:Arr, c:Closure)

Tries to match command line arguments with closure parameters.
Source: autoload/ArgvMatcher.ngs:38

argv

Command line arguments, typically ARGV

c

Closure to match with

Returns

Match (MatchY on success, MatchN on failure). If MatchY is returned it has "matches" property with values is suitable order to call c. If MatchN is returned, it has "message" property explaining why there was no match. Currently it's not printed anywhere.

Example

ArgvMatcher; (["--b", "B", "A", "C"] ~ F(a,b,c) 7).matches  # %[A B C]
(["A", "C", "D", "--b", "B"] ~ ArgvMatcher("positionals", "a") do F(a,b) 7).matches  # %[%[A C D] B]