Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ensure that generator-options command respects log levels #207

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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