Skip to content

Commit

Permalink
feat: ensure that generator-options command respects log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt committed Oct 30, 2023
1 parent ab49363 commit 3a0c55a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common/generatorResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getGenerator(generatorPathOrUrl) {
// if the generator is specified as a git URL, clone it into a temporary directory
if (isUrl(generatorPathOrUrl)) {
const temporaryFolder = fs.mkdtempSync(path.join(os.tmpdir(), "generator"));
log.verbose(
log.standard(
`Cloning generator from ${generatorPathOrUrl} to ${temporaryFolder}`
);
gitClone(generatorPathOrUrl, temporaryFolder);
Expand All @@ -51,7 +51,7 @@ function getGenerator(generatorPathOrUrl) {

// assume that this must be an npm package, installing into a temporary directory
const temporaryFolder = fs.mkdtempSync(path.join(os.tmpdir(), "generator"));
log.verbose(`Installing generator from npm into ${temporaryFolder}`);
log.standard(`Installing generator from npm into ${temporaryFolder}`);
installPackage(generatorPathOrUrl, temporaryFolder);

// NOTE, there is no need to install dependencies, these will automatically be installed
Expand Down
9 changes: 8 additions & 1 deletion src/generatorOptions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { generatorOptionsHelp } = require("./generatorOptions");
const log = require("../common/log");

const generatorOptionsCommand = function (program) {
program
Expand All @@ -10,7 +11,13 @@ const generatorOptionsCommand = function (program) {
"<generator>",
"Git URL, file path or npm package of a language-specific generator"
)
.action(async (generator) => {
.option(
"-l, --logLevel <level>",
"Sets the logging level, options are: quiet ('quiet', 'q' or '0'), standard (default) ('standard', 's' or '1'), verbose ('verbose', 'v' or '2')",
"1"
)
.action(async (generator, options) => {
log.setLogLevel(options.logLevel);
console.log(await generatorOptionsHelp(generator));
});
};
Expand Down

0 comments on commit 3a0c55a

Please sign in to comment.