mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
add output_quotes
This commit is contained in:
parent
6ad84d3274
commit
a82db2762d
15
bin/autojump
15
bin/autojump
@ -354,13 +354,6 @@ def unico(text):
|
|||||||
else:
|
else:
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def output_quotes(config, text):
|
|
||||||
quotes = ""
|
|
||||||
if config['args'].complete and config['args'].bash:
|
|
||||||
quotes = "'"
|
|
||||||
|
|
||||||
output("%s%s%s" % (quotes, text, quotes))
|
|
||||||
|
|
||||||
def output(text, encoding=None):
|
def output(text, encoding=None):
|
||||||
"""
|
"""
|
||||||
Wrapper for the print function, using the filesystem encoding by default
|
Wrapper for the print function, using the filesystem encoding by default
|
||||||
@ -373,6 +366,14 @@ def output(text, encoding=None):
|
|||||||
else:
|
else:
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
|
def output_quotes(config, text):
|
||||||
|
quotes = ""
|
||||||
|
if config['args'].complete and config['args'].bash:
|
||||||
|
quotes = "'"
|
||||||
|
|
||||||
|
result = "%s%s%s" % (quotes, text, quotes)
|
||||||
|
output(result)
|
||||||
|
return result
|
||||||
|
|
||||||
#
|
#
|
||||||
# Main Logic
|
# Main Logic
|
||||||
|
@ -67,17 +67,15 @@ class TestUtilities(unittest.TestCase):
|
|||||||
self.assertEqual(decode('banana man'), u'banana man')
|
self.assertEqual(decode('banana man'), u'banana man')
|
||||||
|
|
||||||
def test_output_quotes(self):
|
def test_output_quotes(self):
|
||||||
output = lambda x: x
|
args = mock.Mock()
|
||||||
from pprint import pprint as pp; import ipdb; ipdb.set_trace()
|
args.bash = True
|
||||||
pp(self.config)
|
args.complete = True
|
||||||
self.config['args'].complete = False
|
config = {'args': args}
|
||||||
self.config['args'].bash = False
|
|
||||||
normal = "foo"
|
normal = "foo"
|
||||||
quotes = "'foo'"
|
quotes = "'foo'"
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(output_quotes(config, normal), quotes)
|
||||||
test_output_quotes(config, normal),
|
|
||||||
normal)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user