diff --git a/src/python/jw/pkg/lib/ExecApp.py b/src/python/jw/pkg/lib/ExecApp.py index f84d85b1..35af49d8 100644 --- a/src/python/jw/pkg/lib/ExecApp.py +++ b/src/python/jw/pkg/lib/ExecApp.py @@ -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', diff --git a/src/python/jw/pkg/lib/ec/Local.py b/src/python/jw/pkg/lib/ec/Local.py index 24e55642..cce2fe2b 100644 --- a/src/python/jw/pkg/lib/ec/Local.py +++ b/src/python/jw/pkg/lib/ec/Local.py @@ -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 diff --git a/test/integration/jw_pkg/help/test-expected.txt b/test/integration/jw_pkg/help/test-expected.txt index 975b67bb..0c711ccf 100644 --- a/test/integration/jw_pkg/help/test-expected.txt +++ b/test/integration/jw_pkg/help/test-expected.txt @@ -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) diff --git a/test/unit/python/jw/pkg/cmds/secrets/lib/FilesContext/test.py b/test/unit/python/jw/pkg/cmds/secrets/lib/FilesContext/test.py index 90e7944f..11937687 100644 --- a/test/unit/python/jw/pkg/cmds/secrets/lib/FilesContext/test.py +++ b/test/unit/python/jw/pkg/cmds/secrets/lib/FilesContext/test.py @@ -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 diff --git a/test/unit/python/jw/pkg/lib/ExecApp/test.py b/test/unit/python/jw/pkg/lib/ExecApp/test.py index b0071e56..4f4a0c31 100644 --- a/test/unit/python/jw/pkg/lib/ExecApp/test.py +++ b/test/unit/python/jw/pkg/lib/ExecApp/test.py @@ -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