lib.ExecApp, ec.Local: Don't use keyword "local" as URI #174
5 changed files with 10 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ class ExecApp(Base): # export
|
|||
help = "Be verbose on stderr about what's being done on the distro level",
|
||||
)
|
||||
parser.add_argument(
|
||||
'--target', default = 'local', help = 'Run commands on this host'
|
||||
'--target', default = 'local://', help = 'Run commands on this host'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--path-filter',
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class Local(Base):
|
||||
|
||||
def __init__(self, uri: str | Uri = 'local', *args: Any, **kwargs: Any) -> None:
|
||||
def __init__(self, uri: str | Uri = 'local://', *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(uri, *args, **kwargs)
|
||||
|
||||
@cache
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ options:
|
|||
(default: true)
|
||||
--verbose Be verbose on stderr about what's being done on the
|
||||
distro level (default: False)
|
||||
--target TARGET Run commands on this host (default: local)
|
||||
--target TARGET Run commands on this host (default: local://)
|
||||
--path-filter PATH_FILTER
|
||||
Default path filter for the exec context, as a
|
||||
name:spec loader string (default: None)
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ import tempfile
|
|||
|
||||
from typing import TYPE_CHECKING, override
|
||||
|
||||
from jw.pkg.cmds.secrets.lib.FilesContext import FilesContext
|
||||
from jw.pkg.cmds.secrets.lib.base import Attrs
|
||||
from jw.pkg.lib.PathFilter import Verdict
|
||||
from jw.pkg.cmds.secrets.lib.FilesContext import FilesContext
|
||||
from jw.pkg.lib.ec.Local import Local
|
||||
from jw.pkg.lib.PathFilter import Verdict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -52,9 +52,13 @@ opts = [o for a in app.parser._actions for o in getattr(a, 'option_strings', ())
|
|||
for opt in ('--interactive', '--verbose', '--target'):
|
||||
assert opt in opts, f'{opt} must be registered by ExecApp'
|
||||
|
||||
# -- The default target is a conforming URI: a bare keyword would
|
||||
# be parsed as a file path, and a downstream URI round-trip
|
||||
# would misread it as a hostname
|
||||
assert app.parser.get_default('target') == 'local://'
|
||||
|
||||
# -- Exiting the async context must close the app, through the
|
||||
# App.__aexit__() that ExecApp.__aexit__() chains to.
|
||||
|
||||
async def exit_context() -> None:
|
||||
async with app:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue