소스 검색

added function 'locate' wrapping mlocate

Fabian Peter Hammerle 7 년 전
부모
커밋
ffed893e4b
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      rc.xsh

+ 9 - 1
rc.xsh

@@ -27,6 +27,14 @@ $RIGHT_PROMPT = '{gitstatus}{env_name: {}}'
 import re as re
 import re as re
 
 
 # required by pinentry-tty when using gpg command:
 # required by pinentry-tty when using gpg command:
-$GPG_TTY=$(tty)
+$GPG_TTY = $(tty)
+
+def locate(*patterns, match_all=True, ignore_case=True):
+    params = []
+    if match_all:
+        params.insert(0, '--all')
+    if ignore_case:
+        params.insert(0, '--ignore-case')
+    return $(locate @(params) -- @(patterns)).split('\n')[:-1]
 
 
 # vim: filetype=python
 # vim: filetype=python