OpenModelica / OpenModelica

OpenModelica is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.
https://openmodelica.org
Other
850 stars 306 forks source link

Add ways to install libraries from the command line #9436

Open casella opened 2 years ago

casella commented 2 years ago

For some applications, see e.g. #9357, it would be nice if one could install libraries directly by launching omc with suitable command-line flages. For example:

omc --installPackages "Modelica 4.0.0" "Buildings 9"

should call the package manager and install those two libraries.

The implementation of --installPackages would be really straightforward: it is just required to parse the strings, extracting the package name and version, and run this simple interactive environment script:

updatePackageIndex(); getErrorString();
for i in 1:nLibs loop
  installPackage(Lib[i], Ver[i]); getErrorString();
end for;
bilderbuchi commented 1 year ago

Thinking about "separation of concerns", would it not be preferable to expose the package manager as a separate slim CLI tool instead of adding this on top of omc compiler via more flags? E.g., provide the above command via (e.g.) ompkg install "Modelica 4.0.0" "Buildings 9"?