It allows for the `besu_env_opts` variable to be either a whitespace separated string or a list Signed-off-by: Edward Evans <edward.evans@consensys.net>pull/16/head
parent
37ceab3780
commit
92e14a6e7b
@ -0,0 +1,18 @@ |
|||||||
|
#! /usr/bin/env python |
||||||
|
|
||||||
|
from typing import Union, List |
||||||
|
|
||||||
|
|
||||||
|
class FilterModule(object): |
||||||
|
def filters(self): |
||||||
|
return { |
||||||
|
'besu_opts_format': self.besuOptsFormat, |
||||||
|
} |
||||||
|
|
||||||
|
def besuOptsFormat(self, besu_env_opts: Union[str, List[str]]): |
||||||
|
if isinstance(besu_env_opts, str): |
||||||
|
besu_env_opts = besu_env_opts.split() |
||||||
|
|
||||||
|
escaped_besu_env_opts = [item.replace('"', '\\"') for item in besu_env_opts] |
||||||
|
|
||||||
|
return f'''"{'" "'.join(escaped_besu_env_opts)}"''' |
Loading…
Reference in new issue