[cli] do not complain about "arguments must be .specs file" from non-toplevel invocations

Summary:
This error message is confusing when the user is not actually running
InferPrint, eg `infer foo`: `Load Error: file foo: arguments must be .specs
files`.

With this diff, we don't get any error for `infer foo`, which is not great
either and will need to be addressed (do we support all the python arguments in
OCaml now too and are able to turn on argument parsing errors in OCaml land?).

Reviewed By: jberdine

Differential Revision: D4397765

fbshipit-source-id: e7ca48f
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 4bf4ba1c59
commit a6f54b9cef

@ -9,6 +9,8 @@
*/ */
open! IStd; open! IStd;
let module CLOpt = CommandLineOption;
let module Hashtbl = Caml.Hashtbl; let module Hashtbl = Caml.Hashtbl;
let module L = Logging; let module L = Logging;
@ -1190,27 +1192,30 @@ let process_summary filters formats_by_report_kind linereader stats top_proc_set
let module AnalysisResults = { let module AnalysisResults = {
type t = list (string, Specs.summary); type t = list (string, Specs.summary);
let spec_files_from_cmdline () => { let spec_files_from_cmdline () =>
/* Find spec files specified by command-line arguments. Not run at init time since the specs if (Config.current_exe == CLOpt.Print) {
files may be generated between init and report time. */ /* Find spec files specified by command-line arguments. Not run at init time since the specs
IList.iter files may be generated between init and report time. */
( IList.iter
fun arg => (
if (not (Filename.check_suffix arg Config.specs_files_suffix) && arg != ".") { fun arg =>
print_usage_exit ("file " ^ arg ^ ": arguments must be .specs files") if (not (Filename.check_suffix arg Config.specs_files_suffix) && arg != ".") {
} print_usage_exit ("file " ^ arg ^ ": arguments must be .specs files")
) }
Config.anon_args; )
if Config.test_filtering { Config.anon_args;
Inferconfig.test (); if Config.test_filtering {
exit 0 Inferconfig.test ();
}; exit 0
if (Config.anon_args == []) { };
load_specfiles () if (Config.anon_args == []) {
load_specfiles ()
} else {
List.rev Config.anon_args
}
} else { } else {
List.rev Config.anon_args load_specfiles ()
} };
};
/** apply [f] to [arg] with the gc compaction disabled during the execution */ /** apply [f] to [arg] with the gc compaction disabled during the execution */
let apply_without_gc f arg => { let apply_without_gc f arg => {

Loading…
Cancel
Save