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

44 Make plugin commands listed in web ui #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

iignatevich
Copy link
Contributor

No description provided.

@davidferlay davidferlay marked this pull request as ready for review June 6, 2024 08:38
)

const (
webTestAct = "web.test"
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

@davidferlay davidferlay Jun 6, 2024

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 in plugin.go anymore. This has the advantage of homogeneity between commands brought by actions and those brought by plugins

Copy link
Contributor Author

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

Copy link
Contributor

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

@davidferlay davidferlay changed the title 44 actions update 44 Make plugin commands listed in web ui Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants