# CLI: introduce \-M; deprecate \-\-mod · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/29cce62a259384e7daffe8fa68a0edf34377c6b3)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 29cce62a259384e7daffe8fa68a0edf34377c6b3

Requested commit: 29cce62a259384e7daffe8fa68a0edf34377c6b3

Commit: 29cce62a259384e7daffe8fa68a0edf34377c6b3

Tree: d0e7439e7669b54e8588e204cbb0f98dce136cd8

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
CLI: introduce -M; deprecate --mod

I changed my mind on how the CLI for Zig modules should work. I don't
like that `--mod` takes 2 parameters. Instead let's swing all the way in
the other direction: `-M[name][=src]`

This is shorter (Zig CLI invocations are long enough already), avoids
the double parameter edge case, and supports the concept of omitting the
source file part of the argument, which was already wanted for `-Mstd`.
The legacy way to encode that was `--mod std ''` - awkward!

Undocumented support for `--mod` remains so that this branch does not
need a zig1.wasm update. The next time that file is updated, support for
`--mod` can be dropped.

Importantly, this commit also adds support for modules that do not have
a root zig source file. In such case, it sets root to cwd and
root_src_path to empty string, and only sets have_zcu to true if a
module is provided with a root zig source file.

```

## Parents

- [41eff5723dd61b19be88830f16d76514583e3339](https://git.cafe/gitcafe/zig/commit/41eff5723dd61b19be88830f16d76514583e3339?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/29cce62a259384e7daffe8fa68a0edf34377c6b3?format=markdown)
