proper Option.Spec.toString for bash script: avoid Token.quote_name of Options.Spec.print_value (amending 3d1746a716fa, see also 39f6f180008d);
authorwenzelm
Tue, 07 Nov 2023 12:02:34 +0100
changeset 78908 f38153e58f21
parent 78907 89274adb0ebe
child 78909 65acbafc70e5
proper Option.Spec.toString for bash script: avoid Token.quote_name of Options.Spec.print_value (amending 3d1746a716fa, see also 39f6f180008d);
src/Pure/System/benchmark.scala
src/Pure/System/options.scala
src/Pure/Tools/build.scala
--- a/src/Pure/System/benchmark.scala	Sun Nov 05 19:55:18 2023 +0100
+++ b/src/Pure/System/benchmark.scala	Tue Nov 07 12:02:34 2023 +0100
@@ -16,7 +16,7 @@
   ): String = {
     val options = Options.Spec("build_hostname", Some(host.name)) :: host.options
     ssh.bash_path(isabelle_home + Path.explode("bin/isabelle")) + " benchmark" +
-      options.map(opt => " -o " + Bash.string(opt.print)).mkString
+      Options.Spec.bash_strings(options)
   }
 
   def benchmark(options: Options, progress: Progress = new Progress()): Unit = {
--- a/src/Pure/System/options.scala	Sun Nov 05 19:55:18 2023 +0100
+++ b/src/Pure/System/options.scala	Tue Nov 07 12:02:34 2023 +0100
@@ -29,6 +29,9 @@
       }
 
     def print(name: String, value: String): String = Properties.Eq(name, print_value(value))
+
+    def bash_strings(opts: Iterable[Spec]): String =
+      opts.iterator.map(opt => "-o " + Bash.string(opt.toString)).mkString(" ", " ", " ")
   }
 
   sealed case class Spec(name: String, value: Option[String] = None, permissive: Boolean = false) {
--- a/src/Pure/Tools/build.scala	Sun Nov 05 19:55:18 2023 +0100
+++ b/src/Pure/Tools/build.scala	Tue Nov 07 12:02:34 2023 +0100
@@ -589,7 +589,7 @@
       if_proper(afp_root, " -A " + ssh.bash_path(afp_root.get)) +
       dirs.map(dir => " -d " + ssh.bash_path(dir)).mkString +
       if_proper(host.numa, " -N") + " -j" + host.jobs +
-      options.map(opt => " -o " + Bash.string(opt.print)).mkString +
+      Options.Spec.bash_strings(options) +
       if_proper(quiet, " -q") +
       if_proper(verbose, " -v")
   }