Skip to content

Commit

Permalink
add dummy cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeVanti committed Nov 1, 2024
1 parent 2403878 commit ca714b5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/cli/cmd-ls.ts
Original file line number Diff line number Diff line change
@@ -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) {}));
}
3 changes: 3 additions & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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(" ")}`);
Expand Down

0 comments on commit ca714b5

Please sign in to comment.