Commit a6ceb00b authored by Guido Günther's avatar Guido Günther

config: when printing a single value only print the value

This is more in line with what `git config` does and eases usage in
scripts.
parent 3da92ba2
......@@ -69,7 +69,7 @@ def build_cmd_parser(section):
def print_single_option(parser, option, printer):
value = parser.get_config_file_value(option)
if value is not None:
printer("%s.%s=%s" % (parser.command, option, value))
printer("%s" % value)
else:
return 2
return 0
......
......@@ -62,7 +62,7 @@ class TestGbpConfigCommand(unittest.TestCase):
printstub = self.SingleValuePrintStub()
query = 'config.color'
ret = gbp.scripts.config.print_cmd_values(query, printstub)
self.assertEqual(printstub.result, '%s=auto' % query)
self.assertEqual(printstub.result, 'auto')
self.assertEqual(ret, 0)
def test_print_cmd_single_value_empty_default(self):
......@@ -70,7 +70,7 @@ class TestGbpConfigCommand(unittest.TestCase):
printstub = self.SingleValuePrintStub()
query = 'buildpackage.keyid'
ret = gbp.scripts.config.print_cmd_values(query, printstub)
self.assertEqual(printstub.result, '%s=' % query)
self.assertEqual(printstub.result, '')
self.assertEqual(ret, 0)
def test_print_cmd_single_value_override(self):
......@@ -78,7 +78,7 @@ class TestGbpConfigCommand(unittest.TestCase):
printstub = self.SingleValuePrintStub()
query = 'config.color-scheme'
ret = gbp.scripts.config.print_cmd_values(query, printstub)
self.assertEqual(printstub.result, '%s=checkcheck' % query)
self.assertEqual(printstub.result, 'checkcheck')
self.assertEqual(ret, 0)
def test_print_cmd_all_values(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment