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

Ability for JavaScript commands to ask for arguments #60

Open
kjk opened this issue Jul 6, 2024 · 0 comments
Open

Ability for JavaScript commands to ask for arguments #60

kjk opened this issue Jul 6, 2024 · 0 comments

Comments

@kjk
Copy link
Owner

kjk commented Jul 6, 2024

Consider a potential JavaScript command that downloads a content of a webpage as markdown and creates a block (or note?) with the result.

This command needs website url as an argument.

We don't have a way to provide such argument.

Could implement by allowing the command to ask for argument by calling:

const argSchema = [["url", "string", "url of a webpage to download as markdown"], ...];
const args = await getArgumentsFromUser(argSchema);
if (args === null) {
   // user cancelled the operation
   return;
}
const url = args.url;
// validate arguments
// do the work

getArgumentsFromUser() is a function implemented by Edna which shows a generic form for entering the values.

It's async because this shows a dialog to the user and we must wait until the user enters the values or cancels dialog.

User can cancel the operation, in which case we return null

There could also be a way to call that function with argument from a block, not sure about the syntax. Maybe something like:

call_function: Slurp Webpage As Markdown
url: https://edna.arslexis.io/help

and then such block could be run with Ctrl + E.
Slurp Webpage As Markdown is a name of the function as defined by the author. Would have to deal with duplicate name functions.

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

No branches or pull requests

1 participant