erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

Proposal: Allow disabling extended start script commands #927

Open codeadict opened 1 year ago

codeadict commented 1 year ago

We are using a custom extended start script but would love to have the one generated by relx as it will be easier to keep up to date and any contribution can benefit our project or i can contribute back any improvement to Relx. One of the limitations i've found is that is easier to extend the script with hooks/extensions but not so easy to remove commands from the existing script. For example we don't need hot code loading / upgrading releases so the following commands are extra boilerplate our users don't need:

  upgrade [Version]       Upgrade the running release to a new version
  downgrade [Version]     Downgrade the running release to a new version
  install [Version]       Install a release
  uninstall [Version]     Uninstall a release
  unpack [Version]        Unpack a release tarball
  versions                Print versions of the release available

I was wondering if this is a need someone else have faced and if relx would accept having an optional configurations like {extended_start_commands, [foreground, stop, ping]} which will default to all if not provided and that way commands could be removed from the script.

ferd commented 1 year ago

This could probably be added by having each of the value in the commands define a template variable like command_foreground and command_stop that the templating function could then pass to bbmustache to use with the {{#varname}}...{{/varname}} sections to show or drop a command.

An option would be to just drop the silenced commands from the help, or drop the command entirely. I'm imagining there could be fewer risks of scripts that complain with linters for unused functions or whatever if we only silenced help rather than removed entire commands.