Bug 1543246 - Add searchfox support to mach. r=froydnj
authorBobby Holley <bobbyholley@gmail.com>
Wed, 10 Apr 2019 16:26:42 +0000
changeset 468823 7de34f2a331ca4867b2c66f39f23a8f37bc7d64f
parent 468822 995276110de48270e38039380ce4674cad10d93e
child 468824 c8dd1ef3daf2537401433b4fec32e6057817c156
push id112755
push userdvarga@mozilla.com
push dateWed, 10 Apr 2019 22:06:41 +0000
treeherdermozilla-inbound@606f85641d0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1543246
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543246 - Add searchfox support to mach. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D26817
tools/mach_commands.py
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -12,16 +12,24 @@ from mach.decorators import (
     Command,
 )
 
 from mozbuild.base import MachCommandBase, MozbuildObject
 
 
 @CommandProvider
 class SearchProvider(object):
+    @Command('searchfox', category='misc',
+             description='Search for something in Searchfox.')
+    @CommandArgument('term', nargs='+', help='Term(s) to search for.')
+    def searchfox(self, term):
+        import webbrowser
+        term = ' '.join(term)
+        uri = 'https://searchfox.org/mozilla-central/search?q=%s' % term
+        webbrowser.open_new_tab(uri)
     @Command('dxr', category='misc',
              description='Search for something in DXR.')
     @CommandArgument('term', nargs='+', help='Term(s) to search for.')
     def dxr(self, term):
         import webbrowser
         term = ' '.join(term)
         uri = 'http://dxr.mozilla.org/mozilla-central/search?q=%s&redirect=true' % term
         webbrowser.open_new_tab(uri)
@@ -41,23 +49,24 @@ class SearchProvider(object):
     def google(self, term):
         import webbrowser
         term = ' '.join(term)
         uri = 'https://www.google.com/search?q=%s' % term
         webbrowser.open_new_tab(uri)
 
     @Command('search', category='misc',
              description='Search for something on the Internets. '
-             'This will open 3 new browser tabs and search for the term on Google, '
-             'MDN, and DXR.')
+             'This will open 4 new browser tabs and search for the term on Google, '
+             'MDN, DXR, and Searchfox.')
     @CommandArgument('term', nargs='+', help='Term(s) to search for.')
     def search(self, term):
         self.google(term)
         self.mdn(term)
         self.dxr(term)
+        self.searchfox(term)
 
 
 @CommandProvider
 class UUIDProvider(object):
     @Command('uuid', category='misc',
              description='Generate a uuid.')
     @CommandArgument('--format', '-f', choices=['idl', 'cpp', 'c++'],
                      help='Output format for the generated uuid.')