JakobGM / astrality

Astrality - A modular and dynamic configuration file manager
https://astrality.readthedocs.io
MIT License
98 stars 3 forks source link

Exit astrality if there are no more actions to be performed #32

Closed JakobGM closed 6 years ago

JakobGM commented 6 years ago

There are several ways we could go about this:

1) Each module could specify a parameter indicating if it is supposed to run in "deamon" mode. "Daemon" might be a misnomer here, as Astrality does not run as a daemon at the moment. Options: daemon, persist, or keep_running? If one or more modules specify this, Astrality will keep running. 2) If a module contains a on_event or on_modified block, daemon will be defaulted to true if not otherwise specified. 3) If reprocess_modified_files is enabled, Astrality will keep running.

Or all of this can be scrapped, and astrality can be invoked with --keep-running as an adittional CLI parameter. If that is the case, we have to decide what the default should be. Alternatively, this flag can overwrite the options specified above.

What do you think, @sshashank124?

sshashank124 commented 6 years ago

I actually like the first approach of switching between persistent mode and one-shot mode depending on if certain options and/or blocks have been specified in any of the config files. The downfall of that approach is that if someone is automatically launching astrality as a background process, it would be less clear whether astrality ran in persistent or one-shot manner especially if they're regularly changing the config files. Although now that I think about it, if the user wants to force that sort of predictable behavior of running in the background persistently, the reprocess_modified_files option's use as mentioned above would be suitable for that

JakobGM commented 6 years ago

Yes, I think that Astrality should be able to deduce what the user would like to do in most cases. I will start with the heuristic version, and then we could add the explicit option at some other time if we want to.