SideCarCLI | Command Line – description –part 1

Summary links SideCarCLI

NoName + Link 
1Description
2Specifications
3Refactor specifications and code
4Create Release
5Finish interceptors
6Send part of command to interceptors
7Line Interceptors
8Finish process after some time
9Documetation Diagram
10Technical Summary
11Create dotnet tool
( 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:

  1. 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).
  2. Intercept the finish of the StartApp and run something with the output ( either all lines, either with the result of the application)
  3. Timers:
    • 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 .