MCPcopy
hub / github.com/commitizen/cz-cli / getPrompter

Function getPrompter

src/commitizen/adapter.js:137–152  ·  view source on GitHub ↗

* Gets the prompter from an adapter given an adapter path

(adapterPath)

Source from the content-addressed store, hash-verified

135 * Gets the prompter from an adapter given an adapter path
136 */
137function getPrompter (adapterPath) {
138 // Resolve the adapter path
139 let resolvedAdapterPath = resolveAdapterPath(adapterPath);
140
141 // Load the adapter
142 let adapter = require(resolvedAdapterPath);
143
144 /* istanbul ignore next */
145 if (adapter && adapter.prompter && isFunction(adapter.prompter)) {
146 return adapter.prompter;
147 } else if (adapter && adapter.default && adapter.default.prompter && isFunction(adapter.default.prompter)) {
148 return adapter.default.prompter;
149 } else {
150 throw new Error(`Could not find prompter method in the provided adapter module: ${adapterPath}`);
151 }
152}
153
154/**
155 * Given a resolvable module name or path, which can be a directory or file, will

Callers 1

gitCzFunction · 0.85

Calls 2

isFunctionFunction · 0.90
resolveAdapterPathFunction · 0.85

Tested by

no test coverage detected