Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make the command list less fragile

It now looks for methods that take no params instead of grepping the name.

masak++ jnthn++ pmichaud++ for giving a thorough explanation of how it works:
  • Loading branch information...
commit f3024e714dcd1bca4f8c992de4466406bd78cf57 1 parent 1a02f2f
@flussence authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 bin/p6xmms2
5 bin/p6xmms2
@@ -2,8 +2,9 @@
use v6;
use XMMS2::Client;
-# Chop out standard objecty things
-my @commands = XMMS2::Client.^methods(:local)».Str.grep(none <new BUILD>);
+#= Gets all the param-less methods - no new() or BUILD().
+# This is 2 and not 0 because methods have an implied :(self, *%_).
+my @commands = XMMS2::Client.^methods(:local).grep(*.signature.params == 2);
multi sub MAIN(Str $command) {
# I already tried doing this in the signature, but when it doesn't match Rakudo barfs.
Please sign in to comment.
Something went wrong with that request. Please try again.