File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed
crates/emmylua_doc_cli/src Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ use std::path::PathBuf;
4
4
#[ derive( Debug , Parser ) ]
5
5
pub struct CmdArgs {
6
6
/// The path of the lua project
7
- #[ arg( long, short) ]
8
- pub input : PathBuf ,
7
+ #[ arg( long, short, num_args = 1 .. ) ]
8
+ pub input : Vec < PathBuf > ,
9
9
10
10
/// Format of the output, default is Markdown
11
11
#[ arg( long, short, default_value = "markdown" ) ]
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use emmylua_code_analysis::{
5
5
} ;
6
6
7
7
#[ allow( unused) ]
8
- pub fn load_workspace ( workspace_folders : Vec < & str > ) -> Option < EmmyLuaAnalysis > {
8
+ pub fn load_workspace ( workspace_folders : Vec < String > ) -> Option < EmmyLuaAnalysis > {
9
9
let mut analysis = EmmyLuaAnalysis :: new ( ) ;
10
10
analysis. init_std_lib ( None ) ;
11
11
Original file line number Diff line number Diff line change @@ -11,12 +11,19 @@ mod markdown_generator;
11
11
12
12
fn main ( ) {
13
13
let args = CmdArgs :: parse ( ) ;
14
- let mut input = args. input ;
15
- if input. is_relative ( ) {
16
- input = std:: env:: current_dir ( ) . ok ( ) . unwrap ( ) . join ( & input) ;
14
+ let current_path = std:: env:: current_dir ( ) . ok ( ) . unwrap ( ) ;
15
+ let input = args. input ;
16
+ let mut files: Vec < String > = Vec :: new ( ) ;
17
+ for path in & input {
18
+ if path. is_relative ( ) {
19
+ let abs_path = current_path. join ( path) . to_str ( ) . unwrap ( ) . to_string ( ) ;
20
+ files. push ( abs_path) ;
21
+ } else {
22
+ files. push ( path. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
23
+ }
17
24
}
18
25
19
- let analysis = init:: load_workspace ( vec ! [ input . to_str ( ) . unwrap ( ) ] ) ;
26
+ let analysis = init:: load_workspace ( files ) ;
20
27
if let Some ( mut analysis) = analysis {
21
28
let res = match args. format {
22
29
Format :: Markdown => markdown_generator:: generate_markdown (
You can’t perform that action at this time.
0 commit comments