Skip to content

Instantly share code, notes, and snippets.

@ufobat
Last active November 29, 2018 17:06
Show Gist options
  • Save ufobat/cea6b00f1020640a9eda776fccf616da to your computer and use it in GitHub Desktop.
Save ufobat/cea6b00f1020640a9eda776fccf616da to your computer and use it in GitHub Desktop.
$ perl6 main.pl6 --aa=b --fasdfasd=234 store foo --no-ja=ja
{aa => b, fasdfasd => 234, no-ja => ja}
$ perl6 -I. -e 'use My::Main' --aa=b --fasdfasd=234 store foo --no-ja=ja
Usage:
-e '...' [--<tags>=...] store <filename>
$ diff main.pl6 My/Main.pm6
2a3
> diff main.pl6 My/Main.pm6
2a3
> unit module My::Main;
use v6.c;
my %*SUB-MAIN-OPTS = ( 'named-anywhere' => True);
multi sub MAIN() is export {
say 1;
}
multi sub MAIN('show', 'unprocessed') is export {
say 2;
}
multi sub MAIN('show', 'store') is export {
say 3;
}
multi sub MAIN('dump', 'config') is export {
say 4;
}
multi sub MAIN('dump', 'projects') is export {
say 5;
}
multi sub MAIN('store', Str:D $filename, *%tags) is export {
say %tags;
}
use v6.c;
unit module My::Main;
our %*SUB-MAIN-OPTS is export = ( 'named-anywhere' => True);
multi sub MAIN() is export {
say 1;
}
multi sub MAIN('show', 'unprocessed') is export {
say 2;
}
multi sub MAIN('show', 'store') is export {
say 3;
}
multi sub MAIN('dump', 'config') is export {
say 4;
}
multi sub MAIN('dump', 'projects') is export {
say 5;
}
multi sub MAIN('store', Str:D $filename, *%tags) is export {
say %tags;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment