Add template function descriptions

This commit is contained in:
Gregory Schier
2024-10-15 07:47:26 -07:00
parent 17a429525f
commit 9d24aefba1
3 changed files with 3 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import fs from 'node:fs';
export const plugin: PluginDefinition = {
templateFunctions: [{
name: 'fs.readFile',
description: 'Read the contents of a file as utf-8',
args: [{ title: 'Select File', type: 'file', name: 'path', label: 'File' }],
async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null> {
if (!args.values.path) return null;

View File

@@ -6,6 +6,7 @@ const algorithms = ['md5', 'sha1', 'sha256', 'sha512'];
export const plugin: PluginDefinition = {
templateFunctions: algorithms.map(algorithm => ({
name: `hash.${algorithm}`,
description: 'Hash a value to its hexidecimal representation',
args: [
{
name: 'input',

View File

@@ -33,6 +33,7 @@ export const plugin: PluginDefinition = {
templateFunctions: [
{
name: 'response.header',
description: 'Read the value of a response header, by name',
args: [
requestArg,
{