Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 404c823

Browse files
added The Platinum Searcher support [#24]
1 parent 6d64122 commit 404c823

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

SearchInProject.sublime-settings

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"search_in_project_TheSilverSearcher_path_to_executable": "ag",
2626
"search_in_project_TheSilverSearcher_mandatory_options": "--column --search-files --nogroup --nocolor",
2727

28+
/* ThePlatinumSearcher configuration */
29+
"search_in_project_ThePlatinumSearcher_path_to_executable": "pt",
30+
"search_in_project_ThePlatinumSearcher_mandatory_options": "--column --nogroup --nocolor",
31+
32+
2833
/* GitGrep configuration */
2934
"search_in_project_GitGrep_path_to_executable": "git",
3035
"search_in_project_GitGrep_mandatory_options": "grep --line",

searchengines/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#__all__ = ["base", "grep", "ack", "the_silver_searcher", "git_grep"]
1+
#__all__ = ["base", "grep", "ack", "the_silver_searcher", "the_platinum_searcher", "git_grep"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
### Start of fixing import paths
2+
import os, sys, inspect
3+
# realpath() with make your script run, even if you symlink it :)
4+
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
5+
if cmd_folder not in sys.path:
6+
sys.path.insert(0, cmd_folder)
7+
# use this if you want to include modules from a subforder
8+
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"subfolder")))
9+
if cmd_subfolder not in sys.path:
10+
sys.path.insert(0, cmd_subfolder)
11+
# Info:
12+
# cmd_folder = os.path.dirname(os.path.abspath(__file__)) # DO NOT USE __file__ !!!
13+
# __file__ fails if script is called in different ways on Windows
14+
# __file__ fails if someone does os.chdir() before
15+
# sys.argv[0] also fails because it doesn't not always contains the path
16+
### End of fixing import paths
17+
18+
import the_silver_searcher
19+
20+
class ThePlatinumSearcher (the_silver_searcher.TheSilverSearcher):
21+
# same implementation, different executable
22+
pass
23+
24+
engine_class = ThePlatinumSearcher

0 commit comments

Comments
 (0)