Explorar el Código

added function 'locate' wrapping mlocate

Fabian Peter Hammerle hace 6 años
padre
commit
ffed893e4b
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. 9 1
      rc.xsh

+ 9 - 1
rc.xsh

@@ -27,6 +27,14 @@ $RIGHT_PROMPT = '{gitstatus}{env_name: {}}'
 import re as re
 
 # 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