Mach Commands are now Standalone Functions

36 views
Skip to first unread message

Mitchell Hentges

unread,
Sep 22, 2021, 7:21:52 PM9/22/21
to dev-pl...@mozilla.org
Alex Lopez just landed a major contribution yesterday: Mach commands are now standalone functions.

This simplifies the commands as well as their associated tests - additional details can be found in the Tooling Announcement.

For a taste of what our brand new, beautiful, modern future looks like, see the comparison between before:
@CommandProvider
class Foo(MachCommandBase):
    @Command("foo", category="misc")
    @CommandArgument("--bar")
    def foo(self, bar):
        print(self.topsrcdir, bar)

And after:

@Command("foo", category="misc") @CommandArgument("--bar") def foo(command_context, bar): print(command_context.topsrcdir, bar)

I hope that this improvement will "Mach" your day better 😉
Thanks for your great work Alex!

--
Mitchell Hentges
Engineering Efficiency
Mozilla
Reply all
Reply to author
Forward
0 new messages