Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

autoprompt

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autoprompt - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

24

dist/autoprompt/autoprompt.js

@@ -34,3 +34,3 @@ import chalk from "chalk";

type: inputType,
name: option.long.replace("--", ""),
name: camelize(option.long.replace("--", "")),
message: option.description,

@@ -41,14 +41,9 @@ choices: hasChoices ? convertStringToOptions(option.flags) : undefined,

export async function autoprompt(program, autoPromptOpts) {
const options = program.options.map(validateOption);
program.parseOptions(process.argv);
const parsedOptions = program.opts();
const promptedOptions = await promptForMissingOptions(autoPromptOpts?.prompter ?? prompt, options, parsedOptions);
const args = process.argv;
args.push(...Object.entries(promptedOptions)
.filter(([_key, value]) => value != null)
.map(([key, value]) => {
return `--${key}=${value}`;
}));
program.parse(args);
return program;
program.hook("preAction", async (_rootCommand, subCommand) => {
const options = subCommand.options.map(validateOption);
// subCommand.parseOptions();
const promptedOptions = await promptForMissingOptions(autoPromptOpts?.prompter ?? prompt, options, subCommand.opts());
Object.assign(subCommand.opts(), promptedOptions);
});
return program.parseAsync();
}

@@ -58,2 +53,5 @@ export async function promptForMissingOptions(prompter, options, parsedOptions) {

.filter((opt) => {
if (opt.flags.includes("(optional)")) {
return false;
}
// only prompt for options that were not passed in

@@ -60,0 +58,0 @@ const missingValue = !parsedOptions[camelize(opt.long.replace("--", ""))];

{
"name": "autoprompt",
"version": "2.0.0",
"version": "2.0.1",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc