forked from LBRYCommunity/lbry-sdk
start command accepts server lists consistent with other commands
This commit is contained in:
parent
86ee6a78f5
commit
76df239d1a
2 changed files with 3 additions and 4 deletions
|
@ -228,9 +228,8 @@ class Servers(Setting[list]):
|
||||||
def contribute_to_argparse(self, parser: ArgumentParser):
|
def contribute_to_argparse(self, parser: ArgumentParser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
self.cli_name,
|
self.cli_name,
|
||||||
nargs="*",
|
|
||||||
help=self.doc,
|
help=self.doc,
|
||||||
default=NOT_SET
|
action='append'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,7 +268,7 @@ class ArgumentAccess:
|
||||||
def load(self, args):
|
def load(self, args):
|
||||||
for setting in self.configuration.get_settings():
|
for setting in self.configuration.get_settings():
|
||||||
value = getattr(args, setting.name, NOT_SET)
|
value = getattr(args, setting.name, NOT_SET)
|
||||||
if value != NOT_SET:
|
if value != NOT_SET and not (isinstance(setting, Servers) and value is None):
|
||||||
self.args[setting.name] = setting.deserialize(value)
|
self.args[setting.name] = setting.deserialize(value)
|
||||||
|
|
||||||
def __contains__(self, item: str):
|
def __contains__(self, item: str):
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ConfigurationTests(unittest.TestCase):
|
||||||
self.assertFalse(c.test_true_toggle)
|
self.assertFalse(c.test_true_toggle)
|
||||||
self.assertFalse(c.test_false_toggle)
|
self.assertFalse(c.test_false_toggle)
|
||||||
|
|
||||||
args = parser.parse_args(['--servers', 'localhost:1', '192.168.0.1:2'])
|
args = parser.parse_args(['--servers=localhost:1', '--servers=192.168.0.1:2'])
|
||||||
c = TestConfig.create_from_arguments(args)
|
c = TestConfig.create_from_arguments(args)
|
||||||
self.assertEqual(c.servers, [('localhost', 1), ('192.168.0.1', 2)])
|
self.assertEqual(c.servers, [('localhost', 1), ('192.168.0.1', 2)])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue