Make ShellCommand a List subclass
Also, let's not require a list in Command (which is used for aliases).
This commit is contained in:
parent
3392ccc58b
commit
72d4421ac8
@ -724,7 +724,6 @@ class Command(BaseType):
|
|||||||
"""Base class for a command value with arguments."""
|
"""Base class for a command value with arguments."""
|
||||||
|
|
||||||
def to_py(self, value):
|
def to_py(self, value):
|
||||||
# FIXME:conf require a list here?
|
|
||||||
self._basic_py_validation(value, str)
|
self._basic_py_validation(value, str)
|
||||||
if not value:
|
if not value:
|
||||||
return
|
return
|
||||||
@ -1106,7 +1105,7 @@ class FormatString(BaseType):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
class ShellCommand(BaseType):
|
class ShellCommand(List):
|
||||||
|
|
||||||
"""A shellcommand which is split via shlex.
|
"""A shellcommand which is split via shlex.
|
||||||
|
|
||||||
@ -1115,7 +1114,7 @@ class ShellCommand(BaseType):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, placeholder=False, none_ok=False):
|
def __init__(self, placeholder=False, none_ok=False):
|
||||||
super().__init__(none_ok)
|
super().__init__(valtype=String(), none_ok=none_ok)
|
||||||
self.placeholder = placeholder
|
self.placeholder = placeholder
|
||||||
|
|
||||||
def from_str(self, value):
|
def from_str(self, value):
|
||||||
@ -1131,8 +1130,7 @@ class ShellCommand(BaseType):
|
|||||||
return split_val
|
return split_val
|
||||||
|
|
||||||
def to_py(self, value):
|
def to_py(self, value):
|
||||||
# FIXME:conf require a str/list here?
|
value = super().to_py(value)
|
||||||
self._basic_py_validation(value, list)
|
|
||||||
if not value:
|
if not value:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -1141,11 +1139,6 @@ class ShellCommand(BaseType):
|
|||||||
"{}-placeholder.")
|
"{}-placeholder.")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def to_str(self, value):
|
|
||||||
if not value:
|
|
||||||
return ''
|
|
||||||
return json.dumps(value)
|
|
||||||
|
|
||||||
|
|
||||||
class Proxy(BaseType):
|
class Proxy(BaseType):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user