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

comline

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comline - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

18

dist/cli.js

@@ -101,4 +101,8 @@ // src/cli.ts

// src/tree.ts
var REQUIRED = `required`;
var OPTIONAL = `optional`;
function required(arg) {
return [`required`, arg];
}
function optional(arg) {
return [`optional`, arg];
}

@@ -145,3 +149,3 @@ // src/cli.ts

const [key, config] = entry;
const { flag: flag2, required, description, example } = config;
const { flag: flag2, required: required2, description, example } = config;
const parse = `parse` in config ? config.parse : parseStringOption;

@@ -151,3 +155,3 @@ const argumentInstances = passed.filter((arg) => arg.startsWith(`--${key}`) || arg.startsWith(`-`) && !arg.startsWith(`--`) && flag2 && arg.split(`=`)[0].includes(flag2));

case 0:
if (required && !optionsFromConfig) {
if (required2 && !optionsFromConfig) {
logger.error(`parsing`, key, `\n\t[Required]: ${description}\n\tExample usage: ${example}`);

@@ -184,8 +188,8 @@ failedValidation = true;

export {
required,
parseStringOption,
parseNumberOption,
parseBooleanOption,
cli,
REQUIRED,
OPTIONAL
optional,
cli
};
{
"name": "comline",
"version": "0.0.1",
"version": "0.0.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": {

@@ -89,26 +89,15 @@ # comline

```typescript
import { Tree, TreePath, OPTIONAL, REQUIRED } from "comline"
import type { Tree, TreePath } from "comline"
import { optional, required } from "comline"
const myTree = [
REQUIRED,
{
hello: [
OPTIONAL,
{
world: null,
$name: [
OPTIONAL,
{
good: [
REQUIRED,
{
morning: null
}
],
},
],
},
],
},
] satisfies Tree
const myTree = required({
hello: optional({
world: null,
$name: optional({
good: required({
morning: null,
}),
}),
}),
}) satisfies Tree

@@ -115,0 +104,0 @@ const validPaths: TreePath<typeof myTree>[] = [

@@ -1,3 +0,7 @@

export const REQUIRED = `required` as const
export const OPTIONAL = `optional` as const
export function required<T>(arg: T): [`required`, T] {
return [`required`, arg]
}
export function optional<T>(arg: T): [`optional`, T] {
return [`optional`, arg]
}

@@ -4,0 +8,0 @@ export type TreeContents = Readonly<{ [key: string]: Tree | null }>

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