|
310 |
search_keys |= search_all |
310 |
search_keys |= search_all |
311 |
|
311 |
|
312 |
if not args: |
312 |
if not args: |
313 |
regex = [re.compile('')] |
313 |
search = lambda x: True |
314 |
else: |
314 |
else: |
315 |
try: |
315 |
try: |
316 |
regex = [re.compile(_) for _ in args] |
316 |
search = re.compile('|'.join(('(?:%s)' % (_,) for _ in args))).search |
317 |
except re.error, ex: |
317 |
except re.error, ex: |
318 |
print >> sys.stderr, 'E: invalid regular expression: %s' % (ex,) |
318 |
print >> sys.stderr, 'E: invalid regular expression: %s' % (ex,) |
319 |
sys.exit(1) |
319 |
sys.exit(1) |
|
352 |
all_vars[key] = (value, None, scope) |
352 |
all_vars[key] = (value, None, scope) |
353 |
|
353 |
|
354 |
for key, (value, vinfo, scope) in all_vars.items(): |
354 |
for key, (value, vinfo, scope) in all_vars.items(): |
355 |
for reg in regex: |
355 |
if ((search_keys and search(key)) or |
356 |
if ((search_keys and reg.search(key)) or |
356 |
(search_values and value and search(value)) or |
357 |
(search_values and value and reg.search(value)) or |
|
|
358 |
(search_all and vinfo and |
357 |
(search_all and vinfo and |
359 |
reg.search(vinfo.get('description', '')))): |
358 |
search(vinfo.get('description', '')))): |
360 |
print_variable_info_string(key, value, vinfo, details=details) |
359 |
print_variable_info_string(key, value, vinfo, details=details) |
361 |
break |
|
|
362 |
|
360 |
|
363 |
if _SHOW_EMPTY & details and not OPT_FILTERS['shell'][2]: |
361 |
if _SHOW_EMPTY & details and not OPT_FILTERS['shell'][2]: |
364 |
patterns = {} |
362 |
patterns = {} |