Permalink
Browse files

working cmi search command

git-svn-id: http://svn.textmate.org/trunk/Bundles/OCaml Experimental Completions.tmbundle@6527 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 716412b commit cd87869230dffd343f7d025907b4510b413fad87 David Powers committed Feb 4, 2007
Showing with 12 additions and 3 deletions.
  1. +12 −3 Commands/Search _cmi.tmCommand
  2. BIN Support/nibs/SearchWindow.nib/keyedobjects.nib
@@ -12,14 +12,23 @@ require "#{ENV['TM_SUPPORT_PATH']}/lib/plist"
searchstring = $stdin.read.strip
-plist = "{ignoreCase = 0; regularExpression = 0; searchString = \"#{searchstring}\"; }"
+plist = "{ignoreCase = 0; regularExpression = 0; searchString = \"#{searchstring}\"; restrictTo = \"all\";}"
options = `'#{ENV['TM_SUPPORT_PATH']}/bin/tm_dialog' -p '#{plist}' -m '#{ENV['TM_BUNDLE_SUPPORT']}/nibs/SearchWindow.nib' | pl`
options = PropertyList.load(options)
if options['returnButton'] == 'Search'
- answers = OCamlCompletion::cmigrep(options['searchString'])
- puts answers
+ searchtype = options['restrictTo'].to_sym
+ searchstring = options['searchString']
+ if options['regularExpression'] != 1
+ searchstring = Regexp.escape(searchstring)
+ end
+ answers = OCamlCompletion::cmigrep(searchstring, searchtype)
+ if answers != ''
+ puts answers
+ else
+ puts 'No matches found'
+ end
end</string>
<key>fallbackInput</key>
<string>word</string>
Binary file not shown.

0 comments on commit cd87869

Please sign in to comment.