File tree Expand file tree Collapse file tree 3 files changed +29
-7
lines changed
crates/emmylua_doc_cli/src Expand file tree Collapse file tree 3 files changed +29
-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,34 @@ 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
+ match current_path. join ( path) . to_str ( ) {
20
+ Some ( p) => {
21
+ files. push ( p. to_string ( ) ) ;
22
+ }
23
+ None => {
24
+ eprintln ! ( "Error: {} is not a valid path." , path. to_str( ) . unwrap( ) ) ;
25
+ exit ( 1 ) ;
26
+ }
27
+ }
28
+ } else {
29
+ match path. to_str ( ) {
30
+ Some ( p) => {
31
+ files. push ( p. to_string ( ) ) ;
32
+ }
33
+ None => {
34
+ eprintln ! ( "Error: {} is not a valid path." , path. to_str( ) . unwrap( ) ) ;
35
+ exit ( 1 ) ;
36
+ }
37
+ }
38
+ }
17
39
}
18
40
19
- let analysis = init:: load_workspace ( vec ! [ input . to_str ( ) . unwrap ( ) ] ) ;
41
+ let analysis = init:: load_workspace ( files ) ;
20
42
if let Some ( mut analysis) = analysis {
21
43
let res = match args. format {
22
44
Format :: Markdown => markdown_generator:: generate_markdown (
You can’t perform that action at this time.
0 commit comments