command-line-api
command-line-api copied to clipboard
Value handling cleanup
This PR has several fixes to value handling.
- General cleanup
- Removed attributes on the
CliCommand.Addmethod (philosophically opposed to needing to step through code to understand a call stack, and this caused me a longer than necessary debugging session) - Renamed individual
ValueSources to more palatable names - Separated fallback and collection
ValueSources. This may require discussion. - Added
TryGetValueto PipelineResult- Check naming on
GetValue. Do we want to mimic dictionaries and use an indexer for throw semantics
- Check naming on
- Now using
FallbackValueSourcefor default values, unifying these similar concepts - Added guard to
ValueProvidercaching - Left the calculated value tests in place as comments as a reminder that we need these tests
Also, on calculated values, Chet found a couple more that I plan to discuss on Friday but can move forward if needed. Both because it was easier, and because I wanted to ensure we retained our experience with the currently rejected approach to custom type handling (calculated values here, but we are planning to instead use custom type conversions in core) I backed calculated values out in a commit in this PR.