Command Line MVC

Aside from basic school work, most of my programming life has been centered around GUIs, most typically websites. I'm use to GUIs, and overall, I love the combination of HTML/CSS as a formatting and styling language. With the introduction of Flex in CSS, it's amazing the different type of themes that can be created with the same HTML page in today's browsers.

However, I've been learning much more about the command line and text-based UIs. This yearning probably comes from the annoyances I have with slow GUIs, slow websites, missing or hidden features, and the apparent backward progression of modern applications.

In a previous post, I've talked about how I've gone back to basics to structure the money app I'm writing around the CLI, and to later construct a GUI around that.

I've been making good progress with that - I have successfully constructed a way to read some bank accounts via the CLI through browser automation. While I've been constructing this CLI, however, I've been following much of the advice in the CLI Guidelines site. At the same time, I've also been trying to avoid re-inventing the wheel. I've found Spectre.Console, which has some very good rendering abilities. For command construction and parsing, I started with using a library from Nate McMaster. However, I wanted more flexibility in my command design than the method his library provided, and started experimenting with System.CommandLine.

After getting several commands of certain complexity, I wanted to simplify the expression of those commands, so I wanted to borrow a concept from ASP.NET MVC, and so I began crafting a light wrapper around System.CommandLine that would convert controllers and their methods into commands that can be called, similar to how methods on controllers in ASP.NET become actions that can be called via the URL.

This wrapper is accessible at Nuget, as a preview package. I expect there to be several breaking changes until the idea matures, so please don't rely on it for production code yet.

I've also open-sourced my source code for this library. If you're interested in viewing, please check it out on the link below. If you'd like to contribute, please comment below.

thunder-commandline-mvc: Summary

To see some more details on using the package itself, check out the main page for it.