Skip to content

Commit 5fecd1b

Browse files
committed
Simplify Homebrew wrapper: remove redundant 'mfc run' syntax
- Remove smart detection logic - wrapper now only accepts 'mfc <case.py>' - Simplify help text and error handling - Update all documentation to remove mentions of 'mfc run' - Cleaner UX: one way to do things, no confusion The wrapper always prepends 'run' internally, but users only need to know the simple 'mfc <case.py>' syntax.
1 parent a6d2641 commit 5fecd1b

File tree

5 files changed

+9
-26
lines changed

5 files changed

+9
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py .
149149
mfc case.py -n 2
150150
```
151151

152-
Use `-n X` to select the number of MPI processes. Both `mfc case.py` and `mfc run case.py` work. For developer commands (`build`, `test`, etc.), clone the repo and use `./mfc.sh`.
152+
Use `-n X` to select the number of MPI processes. For developer commands (`build`, `test`, etc.), clone the repo and use `./mfc.sh`.
153153

154154
### macOS from source
155155

docs/documentation/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mfc case.py -n 2
2727
```
2828

2929
Notes:
30-
- Both `mfc case.py` and `mfc run case.py` work (shorthand auto-detects case files).
30+
- The Homebrew package uses a simplified syntax: just `mfc <case.py>` to run cases.
3131
- Developer commands like `build`, `test`, `clean` are available when you clone the repo and use `./mfc.sh`.
3232
- The package bundles a Python venv and prebuilt binaries; no additional setup is required.
3333
- Examples are installed at `$(brew --prefix mfc)/examples/`.

docs/documentation/running.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ If you installed MFC via Homebrew, run cases with the `mfc` wrapper:
1414

1515
```bash
1616
mfc <path/to/case.py> -n 2
17-
# or explicitly:
18-
mfc run <path/to/case.py> -n 2
1917
```
2018

2119
- Use `-n X` to control the number of MPI processes (ranks).
22-
- Both `mfc case.py` and `mfc run case.py` work (shorthand auto-detects case files).
20+
- The Homebrew package uses a simplified syntax: just `mfc <case.py>` to run cases.
2321
- To use developer commands (`build`, `test`, `clean`, etc.), clone the repository and use `./mfc.sh`.
2422
- The wrapper passes through runtime flags like `-t pre_process simulation`, `-n`, and others; it always runs with preinstalled binaries.
2523
- Examples live at `$(brew --prefix mfc)/examples/`.

packaging/homebrew/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ mfc case.py -n 2
2929

3030
```bash
3131
mfc <case.py> -n <processes>
32-
# or explicitly:
33-
mfc run <case.py> -n <processes>
3432
```
3533

36-
Use `-n X` to set the number of MPI processes. Both syntaxes work (the shorthand version auto-detects case files).
34+
Use `-n X` to set the number of MPI processes.
3735

3836
**Note**: The Homebrew wrapper supports only running cases. For developer commands (`build`, `test`, `clean`, etc.), [clone the repository](https://github.com/MFlowCode/MFC) and use `./mfc.sh`.
3937

packaging/homebrew/mfc.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,17 @@ def install
9494
fi
9595
done
9696
97-
SUBCMD="${ARGS[0]-}"
98-
9997
# Friendly help and guardrails
100-
if [[ ${#ARGS[@]} -eq 0 ]] || [[ "${SUBCMD}" == "--help" ]] || [[ "${SUBCMD}" == "-h" ]]; then
98+
if [[ ${#ARGS[@]} -eq 0 ]] || [[ "${ARGS[0]-}" == "--help" ]] || [[ "${ARGS[0]-}" == "-h" ]]; then
10199
cat <<'HHELP'
102100
MFC (Homebrew) #{version}
103101
104102
Usage:
105103
mfc <case.py> [options]
106-
mfc run <case.py> [options]
107104
108105
Examples:
109106
mfc case.py -n 2
110-
mfc run case.py -n 2 -t pre_process simulation
107+
mfc examples/1D_sodshocktube/case.py -n 2 -t pre_process simulation
111108
112109
Notes:
113110
- This Homebrew wrapper uses prebuilt binaries and a preinstalled venv.
@@ -117,17 +114,8 @@ def install
117114
exit 0
118115
fi
119116
120-
# Smart detection: if first arg looks like a case file, auto-prepend "run"
121-
if [[ "${SUBCMD}" =~ .py$ ]] || [[ -f "${SUBCMD}" ]]; then
122-
ARGS=("run" "${ARGS[@]}")
123-
SUBCMD="run"
124-
fi
125-
126-
if [[ "${SUBCMD}" != "run" ]]; then
127-
echo "mfc (Homebrew): only 'run' is supported in the Homebrew package."
128-
echo "Use 'mfc <case.py>' or clone the repository for developer commands."
129-
exit 2
130-
fi
117+
# Always prepend "run" since this wrapper only supports running cases
118+
ARGS=("run" "${ARGS[@]}")
131119
132120
# Create a temporary working directory (Cellar is read-only)
133121
TMPDIR="$(mktemp -d)"
@@ -226,8 +214,7 @@ def caveats
226214
MFC has been installed successfully!
227215
228216
To run a case:
229-
mfc <case.py>
230-
mfc run <case.py> (explicit form)
217+
mfc <case.py> [options]
231218
232219
Pre-built binaries are also available directly:
233220
pre_process, simulation, post_process

0 commit comments

Comments
 (0)