|
| 1 | +let help = |
| 2 | + {| |
| 3 | +**Private CLI For rescript-vscode usage only** |
| 4 | + |
| 5 | +Examples: |
| 6 | + current-platform.exe dump src/MyFile.res src/MyFile2.res |
| 7 | + current-platform.exe complete src/MyFile.res 0 4 currentContent.res |
| 8 | + current-platform.exe hover src/MyFile.res 10 2 |
| 9 | + current-platform.exe definition src/MyFile.res 9 3 |
| 10 | + |
| 11 | +Options: |
| 12 | + dump: debugging. definition and hover for Foo.res and Foo2.res: |
| 13 | + |
| 14 | + current-platform.exe dump src/Foo.res src/Foo2.res |
| 15 | + |
| 16 | + complete: compute autocomplete for Foo.res at line 0 and column 4, |
| 17 | + where Foo.res is being edited and the editor content is in file current.res. |
| 18 | + |
| 19 | + current-platform.exe complete src/Foo.res 0 4 current.res |
| 20 | + |
| 21 | + hover: get inferred type for Foo.res at line 10 column 2: |
| 22 | + |
| 23 | + current-platform.exe hover src/Foo.res 10 2 |
| 24 | + |
| 25 | + definition: get inferred type for Foo.res at line 10 column 2: |
| 26 | + |
| 27 | + current-platform.exe definition src/Foo.res 10 2|} |
| 28 | + |
| 29 | +let main () = |
| 30 | + match Array.to_list Sys.argv with |
| 31 | + | [_; "complete"; path; line; col; currentFile] -> |
| 32 | + Commands.complete ~path ~line:(int_of_string line) ~col:(int_of_string col) |
| 33 | + ~currentFile |
| 34 | + | [_; "hover"; path; line; col] -> |
| 35 | + Commands.hover ~path ~line:(int_of_string line) ~col:(int_of_string col) |
| 36 | + | [_; "definition"; path; line; col] -> |
| 37 | + Commands.definition ~path ~line:(int_of_string line) |
| 38 | + ~col:(int_of_string col) |
| 39 | + | _ :: "dump" :: files -> Commands.dump files |
| 40 | + | [_; "test"; path] -> Commands.test ~path |
| 41 | + | args when List.mem "-h" args || List.mem "--help" args -> prerr_endline help |
| 42 | + | _ -> |
| 43 | + prerr_endline help; |
| 44 | + exit 1 |
| 45 | + |
| 46 | +;; |
| 47 | +main () |
0 commit comments