File tree Expand file tree Collapse file tree 8 files changed +25
-26
lines changed
analysis_tests/tests-reanalyze/deadcode/expected Expand file tree Collapse file tree 8 files changed +25
-26
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,12 @@ let runAnalysisAndReport ~cmtRoot =
106106let cli () =
107107 let analysisKindSet = ref false in
108108 let cmtRootRef = ref None in
109- let usage = " reanalyze version " ^ Version. version in
110- let versionAndExit () =
111- print_endline usage;
112- exit 0
113- [@@ raises exit]
109+ let usage =
110+ {| Usage : rescript reanalyze [options]
111+
112+ `rescript reanalyze` is powerful dead code analysis tools to maintain a clean, efficient, and distraction- free codebase
113+
114+ Options :| }
114115 in
115116 let rec setAll cmtRoot =
116117 RunConfig. all () ;
@@ -203,14 +204,12 @@ let cli () =
203204 " comma-separated-path-prefixes Report on files whose path has a prefix \
204205 in the list, overriding -suppress (no-op if -suppress is not \
205206 specified)" );
206- (" -version" , Unit versionAndExit, " Show version information and exit" );
207- (" --version" , Unit versionAndExit, " Show version information and exit" );
208207 ( " -write" ,
209208 Set Common.Cli. write,
210209 " Write @dead annotations directly in the source files" );
211210 ]
212211 in
213- Arg. parse speclist print_endline usage;
212+ Arg. parse speclist ( fun _ -> () ) usage;
214213 if ! analysisKindSet = false then setConfig () ;
215214 let cmtRoot = ! cmtRootRef in
216215 runAnalysisAndReport ~cmt Root
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 88
99import * as tty from "node:tty" ;
1010import * as fs from "node:fs" ;
11+ import * as child_process from "node:child_process" ;
1112
12- import { bsc_exe , rescript_exe } from "./common/bins.js" ;
13+ import { bsc_exe , rescript_exe , rescript_tools_exe } from "./common/bins.js" ;
1314import * as bsb from "./common/bsb.js" ;
1415
1516const cwd = process . cwd ( ) ;
@@ -44,6 +45,8 @@ Subcommands:
4445 build
4546 clean
4647 format
48+ doc
49+ reanalyze
4750 dump
4851 help
4952
@@ -125,6 +128,16 @@ if (
125128 mod . main ( subcmdArgs , rescript_exe , bsc_exe ) ;
126129 break ;
127130 }
131+ case "doc" : {
132+ const args = process . argv . slice ( 2 ) ;
133+ child_process . spawnSync ( rescript_tools_exe , args , { stdio : "inherit" } ) ;
134+ break ;
135+ }
136+ case "reanalyze" : {
137+ const args = process . argv . slice ( 2 ) ;
138+ child_process . spawnSync ( rescript_tools_exe , args , { stdio : "inherit" } ) ;
139+ break ;
140+ }
128141 default : {
129142 console . error ( `Error: Unknown command "${ subcmd } ".\n${ helpMessage } ` ) ;
130143 process . exit ( 2 ) ;
Original file line number Diff line number Diff line change 1-
21 Scanning AutoAnnotate.cmt Source:AutoAnnotate.res
32 addVariantCaseDeclaration R AutoAnnotate.res:1:15 path:+AutoAnnotate.variant
43 addRecordLabelDeclaration variant AutoAnnotate.res:4:15 path:+AutoAnnotate.record
Original file line number Diff line number Diff line change 11
2-
32 Exception Analysis
43 Exn.res:1:5-10
54 raises might raise Not_found (Exn.res:1:19) and is not annotated with @raises(Not_found)
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ const cliHelp =
1919 " build\n" +
2020 " clean\n" +
2121 " format\n" +
22+ " doc\n" +
23+ " reanalyze\n" +
2224 " dump\n" +
2325 " help\n" +
2426 "\n" +
Original file line number Diff line number Diff line change 11let docHelp =
2- {| ReScript Tools
3-
4- Output documentation to standard output
2+ {| Usage : rescript doc [file]
53
6- Usage : rescript- tools doc < FILE >
7-
8- Example : rescript- tools doc ./ path/ to / EntryPointLib. res| }
4+ `rescript doc` generate documentation and print to standard output |}
95
106let help =
117 {| ReScript Tools
@@ -16,7 +12,6 @@ Commands:
1612
1713doc < file> Generate documentation
1814reanalyze Reanalyze
19- - v, -- version Print version
2015- h, -- help Print help| }
2116
2217let logAndExit = function
@@ -27,8 +22,6 @@ let logAndExit = function
2722 Printf. eprintf " %s\n " log;
2823 exit 1
2924
30- let version = Version. version
31-
3225let main () =
3326 match Sys. argv |> Array. to_list |> List. tl with
3427 | "doc" :: rest -> (
@@ -77,7 +70,6 @@ let main () =
7770 close_out oc;
7871 exit 0
7972 | [" -h" ] | [" --help" ] -> logAndExit (Ok help)
80- | [" -v" ] | [" --version" ] -> logAndExit (Ok version)
8173 | _ -> logAndExit (Error help)
8274
8375let () = main ()
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments