Skip to content

Commit 4643429

Browse files
committed
Simplify handling of query with multiple spaces
A followup to #312
1 parent 0ff765a commit 4643429

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

lib/cheat_wrapper.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _add_section_name(query):
2626
if '/' in query:
2727
return query
2828
if ' ' in query:
29-
delim = " "
29+
return re.sub(r' +', '/', query, count=1)
3030
elif '+' in query:
3131
delim = "+"
3232

@@ -53,7 +53,6 @@ def cheat_wrapper(query, request_options=None, output_format='ansi'):
5353
Additional request options specified in `request_options`.
5454
"""
5555

56-
5756
def _rewrite_aliases(word):
5857
if word == ':bash.completion':
5958
return ':bash_completion'

lib/cheat_wrapper_test.py

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
python copy file
2020
python/copy file
2121
22+
python file
23+
python/file
24+
2225
g++ -O1
2326
g++/-O1
2427
"""

tests/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
To run unit tests.
2+
3+
python3 -m pytest -v ../lib/
4+
5+
To run input/output tests.
6+
7+
./run-tests.sh

tests/run-tests.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)