-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Consider new syntax or a new option for the --dir CLI option #7309
Description
This issue is inspired by discussion on #7301 and Zulip. To summarize a bit, the --dir syntax is inconsistent between Wasmtime and other runtimes, and a notable inconsistency of Wasmtime is the usage of :: as a delimiter as opposed to a single character such as :. I'll also personally note that there's inconsistency with Docker which is another common tool for a similar operatin which uses :.
As of #7301 and Wasmtime 14/15 the CLI for Wasmtime will support:
--dir foo- opens the host directoryfooand mounts it in the guest asfoo--dir foo::bar- opens the host directoryfooand mounts it in the guest asbar
I find the discussion over on Docker's documentation pretty illuminating here. The gist, as it applies to Wasmtime, appears to be:
- Docker's
-vis the "old" syntax and is acknowledged to be cryptic and error-prone, and this is basically the same as the--dirsyntax Wasmtime has today (and the subject of this comment) - Docker's
--mountis the "new" syntax which uses--mount key=val,key2=val,key3=valwhich is more verbose but more clear
While I wasn't personally present (@sunfishcode maybe you were?) when this option was originally added to Wasmtime my guess is that the choice of :: delimiter for Wasmtime assists with Windows-style paths which have colons in them with absolute paths such as C:\foo\bar. Such a concern does not affect Docker, however, where Docker appears to support docker run -v z:\foo:c:\dest ... according to its documentation.
With all that in mind, there's a few questions in my mind of what to do with Wasmtime:
- Should
--dirbe kept at all? Should this be replaced entirely with a separate option with more obvious syntax to readers? (albeit more verbose to writers) - If
--diris kept, can its delimiter be changed to:to be more consistent with Docker? If so how do Windows paths work? - If a new option is added, what should it be called? Additionally what should its syntax be? For Docker it's a
,-delimited list ofkey=valuepairs, but I'm also not sure how this handles paths-with-commas in them.
Personally I think that while the CLI was overhauled for Wasmtime 14 we can still perform this change when we want. It's probably not too too hard to have broad messaging of a change in syntax if --dir changes or gets replaced. So in that sense while we can't change anything for Wasmtime 14, I do still think changes should be considered for 15+