Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-command syntax to reduce boilerplate #6460

Open
QUser534 opened this issue Sep 2, 2024 · 2 comments
Open

Multi-command syntax to reduce boilerplate #6460

QUser534 opened this issue Sep 2, 2024 · 2 comments
Labels
enhancement New feature request

Comments

@QUser534
Copy link

QUser534 commented Sep 2, 2024

Is your feature request related to a problem? Please describe.

Not creating directories can result in security issues, so oftentimes directories need to be created and this creates a lot of boilerplate profile code.

Example from seafile-applet.profile:

mkdir ${HOME}/.ccnet
mkdir ${HOME}/.config/Seafile
mkdir ${HOME}/Seafile
whitelist ${HOME}/.ccnet
whitelist ${HOME}/.config/Seafile
whitelist ${HOME}/Seafile

It would be nice to reduce this boilerplate by combining it into one directive.

Describe the solution you'd like

I propose either one of two things:

whitelist-mkdir ${HOME}/.ccnet

or

whitelist+ ${HOME}/.ccnet

The + I think works better because the option blacklist-nolog would then become blacklist-mkdir-nolog. It is a bit cleaner to just have blacklist-nolog+.

@QUser534
Copy link
Author

QUser534 commented Sep 2, 2024

I guess the + syntax wouldn't work because it could be a file too. So, I guess whitelist-mkdir and whitelist-mkfile would be how to combine them.

Perhaps a solution is to create a compact method of directive calling.

For example:

mkdir+whitelist ${HOME}/.ccnet

This says run mkdir with the given argument, then run whitelist with the given argument.

This is flexible so would be the same here:

mkdir+blacklist-nolog ${HOME}/.ccnet

It would not require creating a bunch new directives, but just changing how to parse them.

This seems like a small change to the syntax parser of profiles, but would reduce a lot of boilerplate.

@rusty-snake
Copy link
Collaborator

rusty-snake commented Sep 2, 2024

It would not require creating a bunch new directives, but just changing how to parse them

Copy-pasta code with 20 hardcoded combination is simpler than extending parsing logic.

mkdir+whitelist

I like this, you can even noblacklist+mkdir+whitelist.

Previous discussion #3447 (comment)

@kmk3 kmk3 added the enhancement New feature request label Sep 2, 2024
@kmk3 kmk3 changed the title Create directories automatically with "whitelist" / "blacklist" using special syntax to reduce boilerplate Special syntax to reduce boilerplate Sep 2, 2024
@kmk3 kmk3 changed the title Special syntax to reduce boilerplate Multi-command syntax to reduce boilerplate Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request
Projects
None yet
Development

No branches or pull requests

3 participants