Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
File Changes for orientation
Fable.Cli/Entry.fs has been removed in principle
New files:
Musings
CLI
This reworked CLI uses Spectre.Console to manage the CLI interface. Using the framework, we are able to reason about the settings more intuitively, although it uses a C# like OOP approach.
The value provided by offloading the CLI abstraction to a library for the Fable CLI tool is worth this cost.
Backwards Compatibility
This implementation permits all operations being handled from the default command, except for
clean
. This maintains backwards compatibility.All previous switches and commands are supported the same.
Deprecated options such as
--verbose
and--silent
are still functional, although now hidden. These switches are superseded by the--verbosity
option.--verbosity
takes precedence over the deprecated switches.Future Proofing
As more targets mature in Fable, the need to separate CLI options and switches for the different targets will grow.
While the backing compilation system is not changed, the CLI interface is designed for this eventuality.
This provides a structure that is compatible with the current compiler backing, as all
Setting
types are compatible with the superset of args. This is a non issue for the CLI consumers, as eachSetting
type only exposes their specific options via attributes.The structure lends itself to iteration towards allowing targets to safely add their own switches as desired, and also create consuming functions of the CLI interface for different targets to handle their subset of Cli args only, with intellisense completions that are not polluted by other target language options.
Aggregate Validation Errors
The validation of args occurs almost entirely in the base settings class for all arguments/options. This is handy for providing aggregated validation errors.
Previous behaviour
Progress
The CLI interface is almost completely hooked into the previous compilation system. Just need to hook the
--run
flags in (I was originally going to look at having multiple --run flags working, but I'll probably just keep away from changing the backend atm).Have to ensure the path normalizations done in the previous implementation are reflected in this implementation.
Also want to reorder the flags.
Images
fable --help
fable clean --help
fable watch --help
fable js --help
fable js watch --help
fable py --help
fable py watch --help
QoL