Comments (4)
Thanks for the suggestion. I'll investigate this further. As an interim measure I have replicated the FakeInMemoryConsole and added a clear method to clear the memory streams. This gets me moving for my current task.
from clifx.
Hi.
Indeed, the Clear()
method doesn't do anything in FakeConsole
. It may make sense to make it virtual and override in FakeInMemoryConsole
to clear the in-memory streams.
That said, I'm not sure if it's the best solution for your problem. Can you give some example of what you're trying to achieve? I think, in your situation, I would not write to the console at all, but instead use some sort of logging abstraction and configure it to send data to your websocket interface.
from clifx.
Thanks for your quick response. Yes, I agree that this is not the best solution.
If, for example, a command argument is incorrect and I would like to raise a command exception, I would like to be able to intercept this at a high level and send the error message to the client across the web-socket interface.
Even in a scenario, where the execute function is not being called because a parameter is missing, again I would like to intercept the "Missing parameter" message and transmit back to the client. I think this would be useful.
In general, what I am trying to achieve is to have the benefits of the CliFx parsing and error reporting functionality but to have access to the meaningful messages that get output to the console window and in the event of an error transmit them across to the client using the websocket interface.
from clifx.
I see what you mean. This is kind of an unusual use case, I would say. Maybe for your case it would make sense to create a custom IConsole
that uses a custom Stream
that sends data off to the websocket interface you have? And then some sort of AggregateConsole
that combines it together with the existing IConsole
instance you get from CliFx. You would need to provide your own ConsoleWriter
, but it should be fairly simple by replicating this internal method:
CliFx/CliFx/Infrastructure/ConsoleWriter.cs
Lines 275 to 278 in 5e97ebe
from clifx.
Related Issues (20)
- Add IConsole.Clear()
- Separation of model from business logic HOT 7
- Check `BindingConverter<T>` and `BindingValidator<T>` types in analyzers
- Executable name does not appear in help text in some terminals HOT 4
- How do you wrap help output? HOT 1
- Add multi-language output message support HOT 5
- Command examples HOT 3
- Drop support for targets below net5.0 HOT 11
- Positional arguments listed out-of-order when inheriting from base command class HOT 2
- ConsoleWriter is not thread-safe HOT 1
- `IConsole.ReadKey` should return the key that was read HOT 1
- Support `=` (equal sign) as value separator in argument syntax HOT 4
- Assembly binding confusion results in many AD0001 analyzer warnings HOT 11
- Capturing Trace and Debug output HOT 1
- Default `IsRequired` for options based on whether the `required` modifier is used on the property
- CliFx.Analyzers produces hundreds of CS8032 warnings in build HOT 9
- Publishing an exe as "PublishSingleFile=true" with version 2.3.4 fails HOT 2
- Calling commands from other rcommands HOT 3
- Allow the non scalar parameter to be optional or have default value HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clifx.