File tree 3 files changed +7
-1
lines changed
3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -694,6 +694,7 @@ $ npx knip --help
694
694
--strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)
695
695
--ignore-internal Ignore exports with tag @internal (JSDoc/TSDoc)
696
696
-W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)
697
+ --directory [dir] Run process from a different directory (default: cwd)
697
698
--no-gitignore Don't use .gitignore
698
699
--include Report only provided issue type(s), can be comma-separated or repeated (1)
699
700
--exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Options:
11
11
--strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)
12
12
--ignore-internal Ignore exports with tag @internal (JSDoc/TSDoc)
13
13
-W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)
14
+ --directory [dir] Run process from a different directory (default: cwd)
14
15
--no-gitignore Don't use .gitignore
15
16
--include Report only provided issue type(s), can be comma-separated or repeated (1)
16
17
--exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)
52
53
debug : { type : 'boolean' , short : 'd' } ,
53
54
'debug-file-filter' : { type : 'string' } ,
54
55
dependencies : { type : 'boolean' } ,
56
+ directory : { type : 'string' } ,
55
57
exclude : { type : 'string' , multiple : true } ,
56
58
exports : { type : 'boolean' } ,
57
59
help : { type : 'boolean' , short : 'h' } ,
Original file line number Diff line number Diff line change 1
1
// eslint-disable-next-line n/no-restricted-import
2
2
import path from 'node:path' ;
3
+ import parsedArgValues from './cli-arguments.js' ;
4
+
5
+ const { directory } = parsedArgValues ;
3
6
4
7
const isAbsolute = path . isAbsolute ;
5
8
@@ -11,7 +14,7 @@ export const join = path.posix.join;
11
14
12
15
export const toPosix = ( value : string ) => value . split ( path . sep ) . join ( path . posix . sep ) ;
13
16
14
- export const cwd = toPosix ( process . cwd ( ) ) ;
17
+ export const cwd = directory ? path . posix . resolve ( directory ) : toPosix ( process . cwd ( ) ) ;
15
18
16
19
export const resolve = ( ...paths : string [ ] ) =>
17
20
paths . length === 1 ? path . posix . join ( cwd , paths [ 0 ] ) : path . posix . resolve ( ...paths ) ;
You can’t perform that action at this time.
0 commit comments