samedi 5 juin 2021

Design pattern for creating cli to manage background process

I have a program which can monitor directories and sends a telegram message to me when certain conditions are met.

I would like to create a cli to set the parameters of this program such as: Adding a new directory to be monitored; Changing conditions under which to give a notification; Asking for current state of the directory

What design patterns are there for this type of application?

I could imagine:

  1. Having the program running with a prompt for user input in a while loop which would trigger events based on what input is given.
  2. Having 1 program run continually in the background which monitors the folder and just listens for events to change behavior and having a second program which can trigger those events using command-line arguments.

Are there others?
What are the main design parameters to choose between the options?

Aucun commentaire:

Enregistrer un commentaire