goals ['TARGET'] ['VAR=VALUE']
[-C|--directory DIRECTORY] [-d] [-f|--file Goalfile]
[-I|--include DIRECTORY] [-j|--jobs JOBS] [--no-prelude]
+ [-s|--silent|--quiet]
goals --help
(but you can redefine prelude definitions in your goal file if you
want).
+=item B<-s>
+
+=item B<--silent>
+
+=item B<--quiet>
+
+Don't print the shell commands that are run. This is the same as
+turning all S<C<{ CODE }>> sections into S<C<@{ CODE }>> sections.
+
=back
=head1 SEE ALSO
let includes = ref [stdlibdir]
let add_include dir = includes := dir :: !includes
let nr_jobs = ref (nprocs ())
+let silent = ref false
let use_prelude = ref true
let parse () =
jobshelp;
"--no-prelude",Arg.Clear use_prelude,
" Do not automatically use prelude.gl from stdlib";
+ "-s", Arg.Set silent,
+ " Silent operation";
+ "--silent", Arg.Set silent,
+ " Silent operation";
+ "--quiet", Arg.Set silent,
+ " Silent operation";
"-v", Arg.Unit print_version,
" Print version and exit";
"--version", Arg.Unit print_version,
let includes () = !includes
let nr_jobs () = !nr_jobs
+let silent () = !silent
let use_prelude () = !use_prelude
val nr_jobs : unit -> int
(** Number of jobs (-j option). *)
+val silent : unit -> bool
+(** Silent operation (-s option). *)
+
val use_prelude : unit -> bool
(** True if we should load the prelude, or false if --no-prelude. *)
let code = to_shell_script env loc code in
"source " ^ Filename.quote Cmdline.prelude_sh_file ^ "\n" ^
"set -e\n" ^
- (if not quiet then "set -x\n" else "") ^
+ (if not (Cmdline.silent ()) && not quiet then "set -x\n" else "") ^
"\n" ^
code
--- /dev/null
+# Goals test.
+# Copyright (C) 2020 Richard W.M. Jones
+# Copyright (C) 2020 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+goal all = { echo OK }
--- /dev/null
+#!/usr/bin/env bash
+# Goals test.
+# Copyright (C) 2020 Richard W.M. Jones
+# Copyright (C) 2020 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+set -e
+
+goals -s -f 20-option-silent.gl > 20-option-silent.out 2>&1
+test "$(cat 20-option-silent.out)" = "OK"
+rm 20-option-silent.out