@@ -3,11 +3,11 @@ const support = require('../../../index.js')
3
3
4
4
// print out the information for a module and its
5
5
// children
6
- function printModule ( module , depth ) {
6
+ function printModule ( module , depth , argv ) {
7
7
const pkg = module . package
8
8
const moduleInfo = `${ pkg . name } (${ pkg . version } )`
9
9
10
- const supportInfo = support . getSupportData ( pkg , module . path , preferCanonical , basePathOverride )
10
+ const supportInfo = support . getSupportData ( pkg , module . path , argv . canonical , argv [ 'base-path' ] )
11
11
if ( supportInfo . resolved ) {
12
12
console . log ( `${ ' ' . repeat ( 2 * ( depth + 1 ) ) } ${ moduleInfo } - ${ supportInfo . contents } ` )
13
13
} else {
@@ -20,8 +20,6 @@ function printModule (module, depth) {
20
20
} )
21
21
} ;
22
22
23
- let preferCanonical = false
24
- let basePathOverride
25
23
module . exports = function ( opts ) {
26
24
return {
27
25
command : 'show' ,
@@ -30,18 +28,10 @@ module.exports = function (opts) {
30
28
return yargs
31
29
} ,
32
30
handler : function ( argv ) {
33
- preferCanonical = false
34
- if ( argv . canonical ) {
35
- preferCanonical = true
36
- }
37
- basePathOverride = undefined
38
- if ( argv [ 'base-path' ] ) {
39
- basePathOverride = argv [ 'base-path' ]
40
- }
41
31
const Arborist = require ( '@npmcli/arborist' )
42
32
const arb = new Arborist ( )
43
33
arb . loadActual ( ) . then ( root => {
44
- printModule ( root , 0 )
34
+ printModule ( root , 0 , argv )
45
35
} )
46
36
}
47
37
}
0 commit comments