-
Notifications
You must be signed in to change notification settings - Fork 2
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
44 Make plugin commands listed in web ui #50
base: main
Are you sure you want to change the base?
Conversation
) | ||
|
||
const ( | ||
webTestAct = "web.test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's look for action name dynamically to make this file actions.go
generic and copy/pastable to other plugins commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not an issue to dynamically create actions, but issue in action callback developer wants to apply to actions.
this code still needs to be created by dev and attached to so appropriate idss
var testFunc action.ServiceCallbackFunc = func(ctx context.Context, input action.Input) error {
cli.Println("Executing example function...")
// todo
return nil
}
title: arg1 | ||
options: | ||
- name: opt1 | ||
title: opt1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currencly renders as
➜ ./plasmactl
Usage:
plasmactl [flags]
plasmactl [command]
Actions:
web.test test1: desc1 <------- Command from actions.yaml
Additional Commands:
web Starts web server <------- Command from plugin.go
Meaning command definition lives in 2 places and can differ from each other, which is actualy the case in this example:
➜ ./plasmactl web --help
Starts web server
Usage:
plasmactl web [flags]
➜ ./plasmactl web.test --help
test1: desc1
Usage:
plasmactl web.test arg1 [flags]
It would be better for command to be definined in a single place: whether in actions.yaml
or in plugin.go
:
- if command is defined in
plugin.go
, then we only need a trick to make it appear as action (and not listed twice). This has the benefot of minor/no update required to plugin's commands - if command is defined in
actions.yaml
, then it should not be inplugin.go
anymore. This has the advantage of homogeneity between commands brought by actions and those brought by plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't see issue here.
If we need action, it's retrieved from 'actions' and later parsed into cobra command.
if we need cobra command only, we create it. That's why they are split.
What i can do is to separate callback actions into separate group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well maybe task name Run native commands as action is misleading
Main issue we need to solve is that plugin commands are missing from webui.
which only lists actions. Most likely there are other ways to solve that than turning plugin commands into actions
No description provided.