Skip to content

Commit

Permalink
endo/main Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Aug 24, 2020
1 parent 54bfebf commit 3c8dc53
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions packages/endo/src/cli.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
/* global harden */

/* eslint no-shadow: [0] */
import "./lockdown.js";
import { loadLocation, writeArchive, loadArchive } from "./main.js";
import { writeArchive } from "./main.js";
import { search } from "./search.js";
import { compartmentMapForNodeModules } from "./compartmap.js";

function usage(message) {
console.error(message);
return 1;
}

async function noEntryUsage() {
return usage(`expected path to program`);
}

async function noArchiveUsage() {
return usage(`expected path for archive`);
}

async function subcommand([arg, ...rest], handlers) {
const keys = Object.keys(handlers);
if (arg === undefined || !keys.includes(arg)) {
if (arg === undefined || !keys.includes(arg)) {
return usage(`expected one of ${keys}`);
}
return handlers[arg](rest);
}

async function parameter(args, handle, usage) {
const [ arg, ...rest ] = args;
const [arg, ...rest] = args;
if (arg === undefined) {
return usage(`expected an argument`);
}
if (arg.startsWith('-')) {
if (arg.startsWith("-")) {
return usage(`unexpected flag: ${arg}`);
}
return handle(arg, rest);
}

function usage(message) {
console.error(message);
return 1;
}

async function noEntryUsage() {
return usage(`expected path to program`);
}

async function noArchiveUsage() {
return usage(`expected path for archive`);
}

async function run(args, { cwd, read, write, stdout }) {

async function compartmap(args) {
async function handleEntry(applicationPath, args) {
if (args.length) {
Expand Down

0 comments on commit 3c8dc53

Please sign in to comment.