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

Function preview

src/lib/item-input/command-helpers.ts:42–59  ·  view source on GitHub ↗
(formatter: (indent: number) => OutputFormatter<T>)

Source from the content-addressed store, hash-verified

40 let retVal = previousValue
41
42 const preview = async (formatter: (indent: number) => OutputFormatter<T>): Promise<void> => {
43 // TODO: this should probably be moved to someplace more common
44 const indent = command.flags.indent
45 ?? (command.cliConfig.profile.indent as number | undefined)
46 ?? (formatter === yamlFormatter ? 2 : 4)
47 const output = formatter(indent)(retVal)
48
49 const editAgain = await booleanInput(
50 output + '\n\nWould you like to edit further?',
51 { default: false },
52 )
53 if (editAgain) {
54 const answer = await inputDefinition.updateFromUserInput(retVal)
55 if (answer !== cancelAction) {
56 retVal = answer
57 }
58 }
59 }
60
61 // eslint-disable-next-line no-constant-condition
62 while (true) {

Callers 1

updateFromUserInputFunction · 0.85

Calls 1

booleanInputFunction · 0.85

Tested by

no test coverage detected