diff --git a/packages/endo/src/cli.js b/packages/endo/src/cli.js index 8ae19aa7cf..3c3057a193 100644 --- a/packages/endo/src/cli.js +++ b/packages/endo/src/cli.js @@ -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) {