Not command line (or open source), but we've built most of this capability and more into CircuitLab
https://www.circuitlab.com/ (disclosure: I'm one of the developers) -- we have to manage units, metric prefixes, all sorts of arbitrary expressions
https://www.circuitlab.com/docs/expressions/ , real and frequency domain, etc. We also have schematic-wide parameters, the ability to define functions of those parameters to set component values, and/or to set real-time arbitrary behavioral voltages and currents within the circuit graph, etc. On top of that, iteratively solved non-linear feedback systems, Laplace-domain filter notation.... It gets complicated fast!
One of the cool things about understanding circuits and simulation is that you can use the same concepts and tools to model non-electronics-domain problems: thermal systems, mechanical systems, etc. You can combine these, too: for a simple non-confidential example, we recently did modeling of the fusing of tin whiskers, which involves solving the electrical and thermodynamic properties at the same time.