SideCarCLI | Command Line – description –part 1
Summary links SideCarCLI( Description : SideCar for CLI applications. Interceptors for Line, Finish, Timer . See Code )
There are those days a great deal of command line applications that performs a variety of things. The problem is that you cannot control them . The command line performs their duty well – but , from time to time, you need something else integrated with this.
The pattern for this is https://docs.microsoft.com/en-us/azure/architecture/patterns/sidecar – it is applied to microservices , but why not applied to command lines ?
So – let’s start this project with specifications.
Let’s suppose that I want to run an command line application – let name it StartApp. But I want also:
- Intercept every line of the StartApp that is outputting to the console and run something with that with the line ( send to HTTP endpoint, log somewhere, and so on).
- Intercept the finish of the StartApp and run something with the output ( either all lines, either with the result of the application)
- Do not let the StartApp to run more than an maximum amount of time
- Run something periodically with arguments from the StartApp arguments
The solution is to make another application ( let’s name SideCarCLI ) that runs the StartApplication.
What it is complicated her is how we pass the arguments of the SideCarCLI versus the arguments of the StartApp .