File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Command } from "@commander-js/extra-typings" ;
2
+ import { Logger } from "npmlog" ;
3
+ import type { DebugLog } from "../domain/logging" ;
4
+ import type { ReadTextFile } from "../io/fs" ;
5
+ import { withErrorLogger } from "./error-logging" ;
6
+
7
+ /**
8
+ * Makes the `openupm ls` cli command with the given dependencies.
9
+ * @param readTextFile IO function for reading a text file.
10
+ * @param debugLog IO function for debug-logs.
11
+ * @param log Logger for cli output.
12
+ * @returns The command.
13
+ */
14
+ export function makeLsCmd (
15
+ readTextFile : ReadTextFile ,
16
+ debugLog : DebugLog ,
17
+ log : Logger
18
+ ) {
19
+ return new Command ( "ls" )
20
+ . aliases ( [ "list" ] )
21
+ . summary ( "list all currently installed packages" )
22
+ . description (
23
+ `Print the names and versions of all installed packages.
24
+ openupm ls`
25
+ )
26
+ . action ( withErrorLogger ( log , async function ( options ) { } ) ) ;
27
+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { fetchCheckUrlExists } from "../io/www";
15
15
import { makeAddCmd } from "./cmd-add" ;
16
16
import { makeDepsCmd } from "./cmd-deps" ;
17
17
import { makeLoginCmd } from "./cmd-login" ;
18
+ import { makeLsCmd } from "./cmd-ls" ;
18
19
import { makeRemoveCmd } from "./cmd-remove" ;
19
20
import { makeSearchCmd } from "./cmd-search" ;
20
21
import { makeViewCmd } from "./cmd-view" ;
@@ -114,6 +115,8 @@ export function makeOpenupmCli(
114
115
)
115
116
) ;
116
117
118
+ program . addCommand ( makeLsCmd ( readTextFile , debugLog , log ) ) ;
119
+
117
120
// prompt for invalid command
118
121
program . on ( "command:*" , function ( ) {
119
122
log . warn ( "" , `unknown command: ${ program . args . join ( " " ) } ` ) ;
You can’t perform that action at this time.
0 commit comments