OpenSlides / openslides-manage-service

Manage service for OpenSlides 4+
MIT License
4 stars 13 forks source link

implement `set` subcommand #154

Closed peb-adr closed 2 years ago

peb-adr commented 2 years ago

As we discussed a 'semi-generic' sub command for setting attributes on an OS4-instance would be nice.

The general syntax should be something like this:

openslides set <property> [--payload-file | -f] | [payload-string]

where property can be one of the properties updatable by backend actions. (I did this to find suitable actions: OpenSlides/openslides-backend/openslides_backend/action/actions $ grep -r -e '@register_action\(.*\.update.*\)')

It should be possible to provide the payload as a yaml-file (--payload-file). Maybe alternatively as a postitional argument (--payload-string), but this can be optional imo.

As proposed the tool should keep a map[property -> backend-action] to lookup the backend action to call and also serve as white list of working commands.

low prio: the help message for

openslides set --help

may be quite generic. For a more specific one the backend must be available, i.e.

openslides set <property> --help

should ask the backend for available actions and parse the accepted fields form it's response to create a more detailed help message.

This functionality is currently no longer available, but will be reimplemented, see https://github.com/OpenSlides/openslides-backend/issues/1159.

gsiv commented 2 years ago

It should be possible to provide the payload as a yaml-file (--payload-file). Maybe alternatively as a postitional argument (--payload-string), but this can be optional imo.

Another suggestion: openslides set <property> <path>|-, where - indicates stdin. That would cover both use cases without introducing any new flags.

normanjaeckel commented 2 years ago

The grep command is nice but I think we should not support all of them. I will add orga and meeting and it is ok for me if anyone else wants to extend the list. This is easy even without any Golang experience.