MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / stringDef

Function stringDef

src/lib/item-input/misc.ts:61–75  ·  view source on GitHub ↗
(name: string, options?: StringDefOptions)

Source from the content-addressed store, hash-verified

59}
60
61export const stringDef = (name: string, options?: StringDefOptions): InputDefinition<string> => {
62 const buildFromUserInput = async (context?: unknown[]): Promise<string> =>
63 stringInput(name,
64 {
65 ...options,
66 default: defaultWithContextFn(options?.default, context),
67 validate: validateWithContextFn(options?.validate, context),
68 })
69 const summarizeForEdit = (value: string): string => value
70 const updateFromUserInput = (original: string, context?: unknown[]): Promise<string> =>
71 stringInput(name,
72 { ...options, default: original, validate: validateWithContextFn(options?.validate, context) })
73
74 return { name, buildFromUserInput, summarizeForEdit, updateFromUserInput }
75}
76
77export type NumberDefOptions = Omit<IntegerInputOptions<number>, 'default'> & {
78 default?: InputDefinitionDefaultValueOrFn<number>

Callers 9

getInputFromUserFunction · 0.85
getInputFromUserFunction · 0.85
buildInputDefinitionFunction · 0.85
arnDefFunction · 0.85
webHookUrlDefFunction · 0.85
misc.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected