Make -q work with stdin

Example:

  grep -Rn foo . | nvr -q -
pull/83/head v2.0.5
Marco Hinz 6 years ago
parent fa7d9eebde
commit a1a426a894
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

@ -489,10 +489,15 @@ def main(argv=sys.argv, env=os.environ):
path = nvr.server.funcs.fnameescape(os.environ['PWD'])
nvr.server.command('lcd {}'.format(path))
nvr.server.funcs.setqflist('[]')
with open(options.q, 'r') as f:
for line in f.readlines():
if options.q == '-':
for line in sys.stdin:
nvr.server.command("caddexpr '{}'".
format(line.rstrip().replace("'", "''").replace('|', '\|')))
else:
with open(options.q, 'r') as f:
for line in f.readlines():
nvr.server.command("caddexpr '{}'".
format(line.rstrip().replace("'", "''").replace('|', '\|')))
nvr.server.command('silent lcd -')
nvr.server.command('cfirst')

@ -19,7 +19,7 @@ setup(
'console_scripts': ['nvr = nvr.nvr:main']
},
packages = ['nvr'],
version = '2.0.4',
version = '2.0.5',
license = 'MIT',
keywords = 'neovim nvim nvr remote helper',
classifiers = [

Loading…
Cancel
Save