diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 3dfffea1e..8a8d0e979 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -251,8 +251,8 @@ jobs: cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py "$TESTDIR/" echo "Running with $(sysctl -n hw.ncpu) processors..." - # Use absolute path since mfc wrapper creates its own tmpdir - mfc run "$TESTDIR/case.py" -j $(sysctl -n hw.ncpu) + # Use absolute path and shorthand syntax (mfc auto-detects and prepends 'run') + mfc "$TESTDIR/case.py" -j $(sysctl -n hw.ncpu) echo "Test case completed successfully!" diff --git a/packaging/homebrew/mfc.rb b/packaging/homebrew/mfc.rb index 049649830..61ca6dfb9 100644 --- a/packaging/homebrew/mfc.rb +++ b/packaging/homebrew/mfc.rb @@ -102,10 +102,12 @@ def install MFC (Homebrew) #{version} Usage: + mfc [options] mfc run [options] Examples: - mfc run case.py -j 1 + mfc case.py -n 2 + mfc run case.py -n 2 -t pre_process simulation Notes: - This Homebrew wrapper uses prebuilt binaries and a preinstalled venv. @@ -115,9 +117,15 @@ def install exit 0 fi + # Smart detection: if first arg looks like a case file, auto-prepend "run" + if [[ "${SUBCMD}" =~ .py$ ]] || [[ -f "${SUBCMD}" ]]; then + ARGS=("run" "${ARGS[@]}") + SUBCMD="run" + fi + if [[ "${SUBCMD}" != "run" ]]; then echo "mfc (Homebrew): only 'run' is supported in the Homebrew package." - echo "Use 'mfc run ' or clone the repository for developer commands." + echo "Use 'mfc ' or clone the repository for developer commands." exit 2 fi @@ -218,7 +226,8 @@ def caveats MFC has been installed successfully! To run a case: - mfc run + mfc + mfc run (explicit form) Pre-built binaries are also available directly: pre_process, simulation, post_process @@ -226,9 +235,9 @@ def caveats Examples are available in: #{prefix}/examples - Example: + Quick start: cp #{prefix}/examples/1D_sodshocktube/case.py . - mfc run case.py + mfc case.py -n 2 Note: Cantera 3.1.0 is pre-installed in the MFC virtual environment. EOS