1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

add output_quotes

This commit is contained in:
William Ting 2013-07-13 18:36:16 -05:00
parent 6ad84d3274
commit a82db2762d
2 changed files with 14 additions and 15 deletions

View File

@ -354,13 +354,6 @@ def unico(text):
else:
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):
"""
Wrapper for the print function, using the filesystem encoding by default
@ -373,6 +366,14 @@ def output(text, encoding=None):
else:
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

View File

@ -67,17 +67,15 @@ class TestUtilities(unittest.TestCase):
self.assertEqual(decode('banana man'), u'banana man')
def test_output_quotes(self):
output = lambda x: x
from pprint import pprint as pp; import ipdb; ipdb.set_trace()
pp(self.config)
self.config['args'].complete = False
self.config['args'].bash = False
args = mock.Mock()
args.bash = True
args.complete = True
config = {'args': args}
normal = "foo"
quotes = "'foo'"
self.assertEqual(
test_output_quotes(config, normal),
normal)
self.assertEqual(output_quotes(config, normal), quotes)
if __name__ == "__main__":