From ca714b563712ae32ca62b7ef6ef34baa0f1aa5aa Mon Sep 17 00:00:00 2001 From: Ramon Brullo Date: Fri, 1 Nov 2024 19:59:15 +0100 Subject: [PATCH] add dummy cmd --- src/cli/cmd-ls.ts | 27 +++++++++++++++++++++++++++ src/cli/index.ts | 3 +++ 2 files changed, 30 insertions(+) create mode 100644 src/cli/cmd-ls.ts diff --git a/src/cli/cmd-ls.ts b/src/cli/cmd-ls.ts new file mode 100644 index 00000000..b2d75848 --- /dev/null +++ b/src/cli/cmd-ls.ts @@ -0,0 +1,27 @@ +import { Command } from "@commander-js/extra-typings"; +import { Logger } from "npmlog"; +import type { DebugLog } from "../domain/logging"; +import type { ReadTextFile } from "../io/fs"; +import { withErrorLogger } from "./error-logging"; + +/** + * Makes the `openupm ls` cli command with the given dependencies. + * @param readTextFile IO function for reading a text file. + * @param debugLog IO function for debug-logs. + * @param log Logger for cli output. + * @returns The command. + */ +export function makeLsCmd( + readTextFile: ReadTextFile, + debugLog: DebugLog, + log: Logger +) { + return new Command("ls") + .aliases(["list"]) + .summary("list all currently installed packages") + .description( + `Print the names and versions of all installed packages. +openupm ls` + ) + .action(withErrorLogger(log, async function (options) {})); +} diff --git a/src/cli/index.ts b/src/cli/index.ts index c04fcd54..cc88b197 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -15,6 +15,7 @@ import { fetchCheckUrlExists } from "../io/www"; import { makeAddCmd } from "./cmd-add"; import { makeDepsCmd } from "./cmd-deps"; import { makeLoginCmd } from "./cmd-login"; +import { makeLsCmd } from "./cmd-ls"; import { makeRemoveCmd } from "./cmd-remove"; import { makeSearchCmd } from "./cmd-search"; import { makeViewCmd } from "./cmd-view"; @@ -114,6 +115,8 @@ export function makeOpenupmCli( ) ); + program.addCommand(makeLsCmd(readTextFile, debugLog, log)); + // prompt for invalid command program.on("command:*", function () { log.warn("", `unknown command: ${program.args.join(" ")}`);