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

sgray

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sgray - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

7

dist/index.d.ts

@@ -35,3 +35,3 @@ import * as inversify_lib_interfaces_interfaces from 'inversify/lib/interfaces/interfaces';

container?: Container;
yargs?: Argv$1;
yargs?: () => Argv$1;
onError?: ErrorHandler;

@@ -41,4 +41,3 @@ }

container: Container;
yargs: Argv$1;
private isInit;
private createYargs;
private onError;

@@ -48,3 +47,3 @@ constructor({ container, yargs, onError, }?: CLIOptions);

run(processArgs: string[]): Promise<number>;
private init;
clone(): CLI;
}

@@ -51,0 +50,0 @@

@@ -46,6 +46,4 @@ "use strict";

// src/cli.ts
// src/internal/argv.ts
var import_yargs = __toESM(require("yargs/yargs"));
// src/internal/argv.ts
var ArgvBuilder = class {

@@ -99,2 +97,6 @@ static {

};
function createDefaultArgv() {
return (0, import_yargs.default)().help();
}
__name(createDefaultArgv, "createDefaultArgv");

@@ -153,8 +155,7 @@ // src/internal/container.ts

container;
yargs;
isInit = false;
createYargs;
onError;
constructor({ container = createDefaultContainer(), yargs = (0, import_yargs.default)().help(), onError = defualtErrorHandler } = {}) {
constructor({ container = createDefaultContainer(), yargs = createDefaultArgv, onError = defualtErrorHandler } = {}) {
this.container = container;
this.yargs = yargs;
this.createYargs = yargs;
this.onError = onError;

@@ -166,7 +167,21 @@ }

async run(processArgs) {
const yargs = this.createYargs();
const commands = await this.container.getAllAsync(Command);
ArgvBuilder.from(commands).build(yargs, async (Command2, args) => {
const container = this.container.createChild();
container.bind(_CLI).toConstantValue(this);
container.bind(Argv).toConstantValue(yargs);
container.bind(Args).toConstantValue(args);
container.bind(Command2).toSelf();
const command = await container.getAsync(Command2);
try {
args["$?"] = await command.execute();
} catch (error) {
args["$!"] = error;
}
});
const stdout = await this.container.getAsync(Stdout);
const stderr = await this.container.getAsync(Stderr);
await this.init();
return new Promise((resolve) => {
this.yargs.parse(processArgs, {}, (yargsError, argv, yargsOutput) => {
yargs.parse(processArgs, {}, (yargsError, argv, yargsOutput) => {
const error = yargsError ?? argv["$!"];

@@ -189,21 +204,8 @@ if (error != null) {

}
async init() {
if (this.isInit) {
return;
}
const commands = await this.container.getAllAsync(Command);
ArgvBuilder.from(commands).build(this.yargs, async (Command2, args) => {
const container = this.container.createChild();
container.bind(_CLI).toConstantValue(this);
container.bind(Argv).toConstantValue(this.yargs);
container.bind(Args).toConstantValue(args);
container.bind(Command2).toSelf();
const command = await container.getAsync(Command2);
try {
args["$?"] = await command.execute();
} catch (error) {
args["$!"] = error;
}
clone() {
return new _CLI({
container: this.container,
yargs: this.createYargs,
onError: this.onError
});
this.isInit = true;
}

@@ -210,0 +212,0 @@ };

{
"name": "sgray",
"version": "0.5.1",
"version": "0.6.0",
"author": "cumul <gg6123@naver.com>",

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

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

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