Describe the problem
I am currently updating a large project to Tauri v2, which involves around 100 commands. While doing so, I have encountered a significant amount of boilerplate code that I need to maintain across multiple files. Specifically, for each command, I need to:
- Define the command in the plugin's init functiopatn:
.invoke_handler(tauri::generate_handler![auth_get_default_user, auth_set_default_user])
- Include the command in
build.rs:
.plugin(
"auth",
tauri_build::InlinedPlugin::new().commands(&["auth_get_default_user", "auth_set_default_user"]),
)
- Allow for usage of my commands in
capabilities.json:
"auth:allow-auth-get-default-user",
"auth:allow-auth-set-default-user"
This process is not only repetitive but also makes it challenging to maintain and scale the project.
Describe the solution you'd like
Anything that reduces boilerplate, for example:
- New macro that works like
tauri::generate_handler!, but also generates all permissions
- Allowing for all plugin's commands (for example
plugin:allow-all or plugin:allow-*)
Alternatives considered
No response
Additional context
I initially discussed this problem on Discord
Current "sub" problems:
Describe the problem
I am currently updating a large project to Tauri v2, which involves around 100 commands. While doing so, I have encountered a significant amount of boilerplate code that I need to maintain across multiple files. Specifically, for each command, I need to:
build.rs:capabilities.json:This process is not only repetitive but also makes it challenging to maintain and scale the project.
Describe the solution you'd like
Anything that reduces boilerplate, for example:
tauri::generate_handler!, but also generates all permissionsplugin:allow-allorplugin:allow-*)Alternatives considered
No response
Additional context
I initially discussed this problem on Discord
Current "sub" problems:
builder.pluginsInlinedPluginrequires&'static [&'static str]which requires using a lot ofBox::leak