more options;
authorwenzelm
Tue, 12 Nov 2019 16:12:03 +0100
changeset 71300 67c2fed5b0e9
parent 71299 f31903cc57b0
child 71301 3d228a3a88e0
more options;
src/Pure/Tools/phabricator.scala
--- a/src/Pure/Tools/phabricator.scala	Tue Nov 12 16:02:29 2019 +0100
+++ b/src/Pure/Tools/phabricator.scala	Tue Nov 12 16:12:03 2019 +0100
@@ -105,6 +105,7 @@
   val isabelle_tool1 =
     Isabelle_Tool("phabricator", "invoke command-line tool within Phabricator home directory", args =>
     {
+      var list = false
       var name = default_name
 
       val getopts =
@@ -112,18 +113,26 @@
 Usage: isabelle phabricator [OPTIONS] COMMAND [ARGS...]
 
   Options are:
+    -l           list available Phabricator installations
     -n NAME      Phabricator installation name (default: """ + quote(default_name) + """)
 
   Invoke a command-line tool within the home directory of the named Phabricator
   installation.
 """,
+          "l" -> (_ => list = true),
           "n:" -> (arg => name = arg))
 
       val more_args = getopts(args)
-      if (more_args.isEmpty) getopts.usage()
+      if (more_args.isEmpty && !list) getopts.usage()
 
       val progress = new Console_Progress
 
+      if (list) {
+        for (config <- read_config()) {
+          progress.echo("phabricator " + quote(config.name) + " in " + config.root.implode)
+        }
+      }
+
       val config = get_config(name)
 
       val result = progress.bash(Bash.strings(more_args), cwd = config.home.file, echo = true)