New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@effect/cli

Package Overview
Dependencies
Maintainers
0
Versions
348
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/cli - npm Package Compare versions

Comparing version 0.43.0 to 0.43.1

62

dist/cjs/internal/options.js

@@ -6,6 +6,7 @@ "use strict";

});
exports.wizard = exports.withSchema = exports.withPseudoName = exports.withFallbackConfig = exports.withDescription = exports.withDefault = exports.withAlias = exports.text = exports.secret = exports.repeated = exports.redacted = exports.processCommandLine = exports.parse = exports.orElseEither = exports.orElse = exports.optional = exports.none = exports.mapTryCatch = exports.mapEffect = exports.map = exports.keyValueMap = exports.isWithFallbackConfig = exports.isWithDefault = exports.isSingle = exports.isOrElse = exports.isOptions = exports.isMap = exports.isKeyValueMap = exports.isInstruction = exports.isEmpty = exports.isBoth = exports.isBool = exports.integer = exports.getZshCompletions = exports.getUsage = exports.getNames = exports.getMinSize = exports.getMaxSize = exports.getIdentifier = exports.getHelp = exports.getFishCompletions = exports.getBashCompletions = exports.float = exports.filterMap = exports.fileText = exports.fileSchema = exports.fileParse = exports.fileContent = exports.file = exports.directory = exports.date = exports.choiceWithValue = exports.choice = exports.boolean = exports.between = exports.atMost = exports.atLeast = exports.all = exports.OptionsTypeId = void 0;
exports.wizard = exports.withSchema = exports.withPseudoName = exports.withFallbackPrompt = exports.withFallbackConfig = exports.withDescription = exports.withDefault = exports.withAlias = exports.text = exports.secret = exports.repeated = exports.redacted = exports.processCommandLine = exports.parse = exports.orElseEither = exports.orElse = exports.optional = exports.none = exports.mapTryCatch = exports.mapEffect = exports.map = exports.keyValueMap = exports.isWithFallback = exports.isWithDefault = exports.isSingle = exports.isOrElse = exports.isOptions = exports.isMap = exports.isKeyValueMap = exports.isInstruction = exports.isEmpty = exports.isBoth = exports.isBool = exports.integer = exports.getZshCompletions = exports.getUsage = exports.getNames = exports.getMinSize = exports.getMaxSize = exports.getIdentifier = exports.getHelp = exports.getFishCompletions = exports.getBashCompletions = exports.float = exports.filterMap = exports.fileText = exports.fileSchema = exports.fileParse = exports.fileContent = exports.file = exports.directory = exports.date = exports.choiceWithValue = exports.choice = exports.boolean = exports.between = exports.atMost = exports.atLeast = exports.all = exports.OptionsTypeId = void 0;
var Schema = _interopRequireWildcard(require("@effect/schema/Schema"));
var TreeFormatter = _interopRequireWildcard(require("@effect/schema/TreeFormatter"));
var Arr = _interopRequireWildcard(require("effect/Array"));
var Config = _interopRequireWildcard(require("effect/Config"));
var Console = _interopRequireWildcard(require("effect/Console"));

@@ -26,2 +27,3 @@ var Effect = _interopRequireWildcard(require("effect/Effect"));

var InternalPrimitive = _interopRequireWildcard(require("./primitive.js"));
var InternalPrompt = _interopRequireWildcard(require("./prompt.js"));
var InternalListPrompt = _interopRequireWildcard(require("./prompt/list.js"));

@@ -76,3 +78,3 @@ var InternalNumberPrompt = _interopRequireWildcard(require("./prompt/number.js"));

exports.isWithDefault = isWithDefault;
const isWithFallbackConfig = self => self._tag === "WithFallbackConfig";
const isWithFallback = self => self._tag === "WithFallback";
// =============================================================================

@@ -82,3 +84,3 @@ // Constructors

/** @internal */
exports.isWithFallbackConfig = isWithFallbackConfig;
exports.isWithFallback = isWithFallback;
const all = function () {

@@ -277,5 +279,12 @@ if (arguments.length === 1) {

}
return makeWithFallbackConfig(self, config);
return makeWithFallback(self, config);
});
/** @internal */
const withFallbackPrompt = exports.withFallbackPrompt = /*#__PURE__*/(0, _Function.dual)(2, (self, prompt) => {
if (isInstruction(self) && isWithDefault(self)) {
return makeWithDefault(withFallbackPrompt(self.options, prompt), self.fallback);
}
return makeWithFallback(self, prompt);
});
/** @internal */
const withDescription = exports.withDescription = /*#__PURE__*/(0, _Function.dual)(2, (self, desc) => modifySingle(self, single => {

@@ -364,5 +373,6 @@ const description = InternalHelpDoc.sequence(single.description, InternalHelpDoc.p(desc));

}
case "WithFallbackConfig":
case "WithFallback":
{
return InternalHelpDoc.mapDescriptionList(getHelpInternal(self.options), (span, block) => [span, InternalHelpDoc.sequence(block, InternalHelpDoc.p("This option can be set from environment variables."))]);
const helpDoc = Config.isConfig(self.effect) ? InternalHelpDoc.p("This option can be set from environment variables.") : InternalPrompt.isPrompt(self.effect) ? InternalHelpDoc.p("Will prompt the user for input if this option is not provided.") : InternalHelpDoc.empty;
return InternalHelpDoc.mapDescriptionList(getHelpInternal(self.options), (span, block) => [span, InternalHelpDoc.sequence(block, helpDoc)]);
}

@@ -396,3 +406,3 @@ }

case "Map":
case "WithFallbackConfig":
case "WithFallback":
case "WithDefault":

@@ -408,3 +418,3 @@ {

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -458,3 +468,3 @@ return 0;

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -515,3 +525,3 @@ return getMaxSizeInternal(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -600,7 +610,7 @@ return InternalUsage.optional(getUsageInternal(self.options));

};
const makeWithFallbackConfig = (options, config) => {
const makeWithFallback = (options, effect) => {
const op = Object.create(proto);
op._tag = "WithFallbackConfig";
op._tag = "WithFallback";
op.options = options;
op.config = config;
op.effect = effect;
return op;

@@ -642,5 +652,5 @@ };

}
case "WithFallbackConfig":
case "WithFallback":
{
return makeWithFallbackConfig(modifySingle(self.options, f), self.config);
return makeWithFallback(modifySingle(self.options, f), self.effect);
}

@@ -668,3 +678,3 @@ }

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -700,3 +710,3 @@ return loop(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -828,5 +838,5 @@ return toParseableInstruction(self.options);

}
case "WithFallbackConfig":
case "WithFallback":
{
return parseInternal(self.options, args, config).pipe(Effect.catchTag("MissingValue", e => Effect.mapError(self.config, () => e)));
return parseInternal(self.options, args, config).pipe(Effect.catchTag("MissingValue", e => Effect.mapError(self.effect, () => e)));
}

@@ -916,3 +926,3 @@ }

}
case "WithFallbackConfig":
case "WithFallback":
{

@@ -922,2 +932,6 @@ if (isBoolInternal(self.options)) {

}
// TODO: should we use the prompt directly here?
if (InternalPrompt.isPrompt(self.effect)) {
return wizardInternal(self.options, config);
}
const defaultHelp = InternalHelpDoc.p(`Try load this option from the environment?`);

@@ -1241,3 +1255,3 @@ const message = (0, _Function.pipe)(getHelpInternal(self.options), InternalHelpDoc.sequence(defaultHelp));

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1269,3 +1283,3 @@ return getShortDescription(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1304,3 +1318,3 @@ return getBashCompletions(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1345,3 +1359,3 @@ return getFishCompletions(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1348,0 +1362,0 @@ return getZshCompletions(self.options, state);

@@ -6,3 +6,3 @@ "use strict";

});
exports.wizard = exports.withSchema = exports.withPseudoName = exports.withFallbackConfig = exports.withDescription = exports.withDefault = exports.withAlias = exports.text = exports.secret = exports.repeated = exports.redacted = exports.processCommandLine = exports.parse = exports.orElseEither = exports.orElse = exports.optional = exports.none = exports.mapTryCatch = exports.mapEffect = exports.map = exports.keyValueMap = exports.isOptions = exports.isBool = exports.integer = exports.getUsage = exports.getIdentifier = exports.getHelp = exports.float = exports.filterMap = exports.fileText = exports.fileSchema = exports.fileParse = exports.fileContent = exports.file = exports.directory = exports.date = exports.choiceWithValue = exports.choice = exports.boolean = exports.between = exports.atMost = exports.atLeast = exports.all = exports.OptionsTypeId = void 0;
exports.wizard = exports.withSchema = exports.withPseudoName = exports.withFallbackPrompt = exports.withFallbackConfig = exports.withDescription = exports.withDefault = exports.withAlias = exports.text = exports.secret = exports.repeated = exports.redacted = exports.processCommandLine = exports.parse = exports.orElseEither = exports.orElse = exports.optional = exports.none = exports.mapTryCatch = exports.mapEffect = exports.map = exports.keyValueMap = exports.isOptions = exports.isBool = exports.integer = exports.getUsage = exports.getIdentifier = exports.getHelp = exports.float = exports.filterMap = exports.fileText = exports.fileSchema = exports.fileParse = exports.fileContent = exports.file = exports.directory = exports.date = exports.choiceWithValue = exports.choice = exports.boolean = exports.between = exports.atMost = exports.atLeast = exports.all = exports.OptionsTypeId = void 0;
var InternalOptions = _interopRequireWildcard(require("./internal/options.js"));

@@ -294,2 +294,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }

*/
const withFallbackPrompt = exports.withFallbackPrompt = InternalOptions.withFallbackPrompt;
/**
* @since 1.0.0
* @category combinators
*/
const withDescription = exports.withDescription = InternalOptions.withDescription;

@@ -296,0 +301,0 @@ /**

@@ -20,2 +20,3 @@ /**

import type { Primitive } from "./Primitive.js";
import type { Prompt } from "./Prompt.js";
import type { Usage } from "./Usage.js";

@@ -423,2 +424,10 @@ import type { ValidationError } from "./ValidationError.js";

*/
export declare const withFallbackPrompt: {
<B>(prompt: Prompt<B>): <A>(self: Options<A>) => Options<B | A>;
<A, B>(self: Options<A>, prompt: Prompt<B>): Options<A | B>;
};
/**
* @since 1.0.0
* @category combinators
*/
export declare const withDescription: {

@@ -425,0 +434,0 @@ (description: string): <A>(self: Options<A>) => Options<A>;

import * as Schema from "@effect/schema/Schema";
import * as TreeFormatter from "@effect/schema/TreeFormatter";
import * as Arr from "effect/Array";
import * as Config from "effect/Config";
import * as Console from "effect/Console";

@@ -19,2 +20,3 @@ import * as Effect from "effect/Effect";

import * as InternalPrimitive from "./primitive.js";
import * as InternalPrompt from "./prompt.js";
import * as InternalListPrompt from "./prompt/list.js";

@@ -58,3 +60,3 @@ import * as InternalNumberPrompt from "./prompt/number.js";

/** @internal */
export const isWithFallbackConfig = self => self._tag === "WithFallbackConfig";
export const isWithFallback = self => self._tag === "WithFallback";
// =============================================================================

@@ -232,5 +234,12 @@ // Constructors

}
return makeWithFallbackConfig(self, config);
return makeWithFallback(self, config);
});
/** @internal */
export const withFallbackPrompt = /*#__PURE__*/dual(2, (self, prompt) => {
if (isInstruction(self) && isWithDefault(self)) {
return makeWithDefault(withFallbackPrompt(self.options, prompt), self.fallback);
}
return makeWithFallback(self, prompt);
});
/** @internal */
export const withDescription = /*#__PURE__*/dual(2, (self, desc) => modifySingle(self, single => {

@@ -319,5 +328,6 @@ const description = InternalHelpDoc.sequence(single.description, InternalHelpDoc.p(desc));

}
case "WithFallbackConfig":
case "WithFallback":
{
return InternalHelpDoc.mapDescriptionList(getHelpInternal(self.options), (span, block) => [span, InternalHelpDoc.sequence(block, InternalHelpDoc.p("This option can be set from environment variables."))]);
const helpDoc = Config.isConfig(self.effect) ? InternalHelpDoc.p("This option can be set from environment variables.") : InternalPrompt.isPrompt(self.effect) ? InternalHelpDoc.p("Will prompt the user for input if this option is not provided.") : InternalHelpDoc.empty;
return InternalHelpDoc.mapDescriptionList(getHelpInternal(self.options), (span, block) => [span, InternalHelpDoc.sequence(block, helpDoc)]);
}

@@ -351,3 +361,3 @@ }

case "Map":
case "WithFallbackConfig":
case "WithFallback":
case "WithDefault":

@@ -363,3 +373,3 @@ {

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -413,3 +423,3 @@ return 0;

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -470,3 +480,3 @@ return getMaxSizeInternal(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -555,7 +565,7 @@ return InternalUsage.optional(getUsageInternal(self.options));

};
const makeWithFallbackConfig = (options, config) => {
const makeWithFallback = (options, effect) => {
const op = Object.create(proto);
op._tag = "WithFallbackConfig";
op._tag = "WithFallback";
op.options = options;
op.config = config;
op.effect = effect;
return op;

@@ -597,5 +607,5 @@ };

}
case "WithFallbackConfig":
case "WithFallback":
{
return makeWithFallbackConfig(modifySingle(self.options, f), self.config);
return makeWithFallback(modifySingle(self.options, f), self.effect);
}

@@ -623,3 +633,3 @@ }

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -654,3 +664,3 @@ return loop(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -782,5 +792,5 @@ return toParseableInstruction(self.options);

}
case "WithFallbackConfig":
case "WithFallback":
{
return parseInternal(self.options, args, config).pipe(Effect.catchTag("MissingValue", e => Effect.mapError(self.config, () => e)));
return parseInternal(self.options, args, config).pipe(Effect.catchTag("MissingValue", e => Effect.mapError(self.effect, () => e)));
}

@@ -870,3 +880,3 @@ }

}
case "WithFallbackConfig":
case "WithFallback":
{

@@ -876,2 +886,6 @@ if (isBoolInternal(self.options)) {

}
// TODO: should we use the prompt directly here?
if (InternalPrompt.isPrompt(self.effect)) {
return wizardInternal(self.options, config);
}
const defaultHelp = InternalHelpDoc.p(`Try load this option from the environment?`);

@@ -1195,3 +1209,3 @@ const message = pipe(getHelpInternal(self.options), InternalHelpDoc.sequence(defaultHelp));

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1223,3 +1237,3 @@ return getShortDescription(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1257,3 +1271,3 @@ return getBashCompletions(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1297,3 +1311,3 @@ return getFishCompletions(self.options);

case "WithDefault":
case "WithFallbackConfig":
case "WithFallback":
{

@@ -1300,0 +1314,0 @@ return getZshCompletions(self.options, state);

@@ -285,2 +285,7 @@ import * as InternalOptions from "./internal/options.js";

*/
export const withFallbackPrompt = InternalOptions.withFallbackPrompt;
/**
* @since 1.0.0
* @category combinators
*/
export const withDescription = InternalOptions.withDescription;

@@ -287,0 +292,0 @@ /**

{
"name": "@effect/cli",
"version": "0.43.0",
"version": "0.43.1",
"description": "A library for building command-line interfaces with Effect",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,2 +21,3 @@ /**

import type { Primitive } from "./Primitive.js"
import type { Prompt } from "./Prompt.js"
import type { Usage } from "./Usage.js"

@@ -530,2 +531,11 @@ import type { ValidationError } from "./ValidationError.js"

*/
export const withFallbackPrompt: {
<B>(prompt: Prompt<B>): <A>(self: Options<A>) => Options<B | A>
<A, B>(self: Options<A>, prompt: Prompt<B>): Options<A | B>
} = InternalOptions.withFallbackPrompt
/**
* @since 1.0.0
* @category combinators
*/
export const withDescription: {

@@ -532,0 +542,0 @@ (description: string): <A>(self: Options<A>) => Options<A>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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