Release v0.5.0 - Basic yet adaptable configuration
The latest release of JCLI has been released, featuring a very basic yet moderately adaptable configuration service.
This post also serves as a test of how I plan to format any future 'release' or 'changelog' style posts.
The following changes were implemented:
- Feature - Add
- Feature - Add functions such as
bold, etc. to
- Feature - Add
UserIO.exceptionline of logging functions (e.g.
- Breaking change - The members of the
Ansi4Bitenum now use camelCase instead of PascalCase. This is simple enough to fix however.
- Testing - The example runner can now test that an example's output matches a regex.
A common action that a command line application needs to perform, is the ability to create, store, and load configuration files.
To lower the barrier of entry for creating, or even prototyping a CLI application using JCLI, this release provides a simple interface used to serialise and deserialise data, while allowing commands to be free of the burden or technical aspects of having to manage their configuration files.
An example can be seen here.
IConfig is the core interface, which is what commands should be injected with, using JCLI's support for dependency injection.
Adapters are types that provide a static
deserialise function, they are used by "adaptable"
IConfig implementations to
allow the user to choose the underlying serialisation library.
This release ships with an adapter for the asdf library.
AdaptableFileConfig is an adaptable
IConfig that uses the file system to store the configuration value, serialised using whichever
adapter you pass to it.
AnsiText now has support for the following ANSI codes:
- Slow Blink
- Rapid Blink
Of course, it'll be down to the individual terminal to support each of these features. In general though, if it's supported in Windows' command line, it's supported everywhere else.
Here is an screenshot from the new Windows Terminal, emulating powershell:
UserIO Exception Logging
There's a relatively common situation where your program needs to display an exception in detail, but doesn't want to leave the exception uncaught just to display this information (i.e. keep the program running even on exception).
UserIO now have the
exception range of logging function (
debugException) which can be used
to easily display the information of an exception.
Here's an example from JCLI's configuration example:
In the event that there's actually someone else other than me that uses this library, I'd just like to remind you that I'm completely open to suggestions, criticism, PRs, etc.