Class CommandLine


  • @ProgramDescription(value="Command-line utility for making ad-hoc LaBB-CAT API calls.",
                        arguments="function [arg ...]")
    public class CommandLine
    extends nzilbb.util.CommandLineProgram
    Command-line utility for making ad-hoc LaBB-CAT API calls.

    The utility generally prints the JSON response from the server. e.g.

    java -jar nzilbb.labbcat.jar --labbcaturl=… --username=… --password=… getLayerIds

    … might print:

    {"title":"LaBB-CAT","version":"20200212.1030","code":0,"errors":[],"messages":[],"model":"http://localhost:8080/labbcat/"}

    Human-readable JSON can be obtained using the --indent switch, e.g.

    java -jar nzilbb.labbcat.jar --indent --labbcaturl=… getLayer orthography

    … might print:

    {
         "title": "LaBB-CAT",
         "version": "20200212.1030",
         "code": 0,
         "errors": [],
         "messages": [],
         "model": {
             "id": "orthography",
             "parentId": "transcript",
             "description": "Standard Orthography",
             "alignment": 0,
             "peers": false,
             "peersOverlap": false,
             "parentIncludes": false,
             "saturated": false,
             "type": "string",
             "validLabels": {},
             "category": null
         }
     }
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • CommandLine

        public CommandLine()
        Default constructor.
    • Method Detail

      • main

        public static void main​(String[] argv)
        Main entrypoint.
        Parameters:
        argv - Array or command-line parameters.
      • getLabbcatUrl

        public String getLabbcatUrl()
        Getter for labbcatUrl: Base URL for the LaBB-CAT server.
        Returns:
        Base URL for the LaBB-CAT server.
      • setLabbcatUrl

        @Switch(value="Base URL for the LaBB-CAT server.",
                compulsory=true)
        public CommandLine setLabbcatUrl​(String newLabbcatUrl)
        Setter for labbcatUrl: Base URL for the LaBB-CAT server.
        Parameters:
        newLabbcatUrl - Base URL for the LaBB-CAT server.
        Returns:
        A reference to this object, so that setters can be chained.
      • getUsername

        public String getUsername()
        Getter for username: Username for LaBB-CAT.
        Returns:
        Username for LaBB-CAT.
      • setUsername

        @Switch("Username for LaBB-CAT.")
        public CommandLine setUsername​(String newUsername)
        Setter for username: Username for LaBB-CAT.
        Parameters:
        newUsername - Username for LaBB-CAT.
        Returns:
        A reference to this object, so that setters can be chained.
      • getPassword

        public String getPassword()
        Getter for password: Password for LaBB-CAT.
        Returns:
        Password for LaBB-CAT.
      • setPassword

        @Switch("Password for LaBB-CAT.")
        public CommandLine setPassword​(String newPassword)
        Setter for password: Password for LaBB-CAT.
        Parameters:
        newPassword - Password for LaBB-CAT.
        Returns:
        A reference to this object, so that setters can be chained.
      • getVerbose

        public Boolean getVerbose()
        Getter for verbose: Whether to produce verbose logging.
        Returns:
        Whether to produce verbose logging.
      • setVerbose

        @Switch("Whether to produce verbose logging.")
        public CommandLine setVerbose​(Boolean newVerbose)
        Setter for verbose: Whether to produce verbose logging.
        Parameters:
        newVerbose - Whether to produce verbose logging.
        Returns:
        A reference to this object, so that setters can be chained.
      • getIndent

        public Boolean getIndent()
        Getter for indent: Whether to indent JSON for readability.
        Returns:
        Whether to indent JSON for readability.
      • setIndent

        @Switch("Whether to indent JSON for readability.")
        public CommandLine setIndent​(Boolean newIndent)
        Setter for indent: Whether to indent JSON for readability.
        Parameters:
        newIndent - Whether to indent JSON for readability.
        Returns:
        A reference to this object, so that setters can be chained.
      • start

        public void start()
        Start the utility