MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / promptExampleName

Method promptExampleName

packages/cli/generators/example/index.js:101–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 _describeExamples() {}
100
101 promptExampleName() {
102 if (this.shouldExit()) return;
103 if (this.options['example-name']) {
104 this.exampleName = this.options['example-name'];
105 return;
106 }
107
108 const choices = Object.keys(EXAMPLES).map(k => {
109 return {
110 name: `${k}: ${EXAMPLES[k]}`,
111 value: `${k}`,
112 short: `${k}`,
113 };
114 });
115 const prompts = [
116 {
117 name: 'name',
118 message: g.f('What example would you like to clone?'),
119 type: 'list',
120 choices,
121 },
122 ];
123 return this.prompt(prompts).then(
124 answers => (this.exampleName = answers.name),
125 );
126 }
127
128 validateExampleName() {
129 if (this.shouldExit()) return;

Callers

nothing calls this directly

Calls 3

shouldExitMethod · 0.80
promptMethod · 0.80
keysMethod · 0.65

Tested by

no test coverage detected