Package nzilbb.labbcat.util
Class CommandLine
- java.lang.Object
-
- nzilbb.util.CommandLineProgram
-
- nzilbb.labbcat.util.CommandLine
-
@ProgramDescription(value="Command-line utility for making ad-hoc LaBB-CAT API calls.", arguments="function [arg ...]") public class CommandLine extends nzilbb.util.CommandLineProgramCommand-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
--indentswitch, 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 Summary
Constructors Constructor Description CommandLine()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleangetIndent()Getter forindent: Whether to indent JSON for readability.StringgetLabbcatUrl()Getter forlabbcatUrl: Base URL for the LaBB-CAT server.StringgetPassword()Getter forpassword: Password for LaBB-CAT.StringgetUsername()Getter forusername: Username for LaBB-CAT.BooleangetVerbose()Getter forverbose: Whether to produce verbose logging.static voidmain(String[] argv)Main entrypoint.CommandLinesetIndent(Boolean newIndent)Setter forindent: Whether to indent JSON for readability.CommandLinesetLabbcatUrl(String newLabbcatUrl)Setter forlabbcatUrl: Base URL for the LaBB-CAT server.CommandLinesetPassword(String newPassword)Setter forpassword: Password for LaBB-CAT.CommandLinesetUsername(String newUsername)Setter forusername: Username for LaBB-CAT.CommandLinesetVerbose(Boolean newVerbose)Setter forverbose: Whether to produce verbose logging.voidstart()Start the utility
-
-
-
Method Detail
-
main
public static void main(String[] argv)
Main entrypoint.- Parameters:
argv- Array or command-line parameters.
-
getLabbcatUrl
public String getLabbcatUrl()
Getter forlabbcatUrl: 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 forlabbcatUrl: 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 forusername: Username for LaBB-CAT.- Returns:
- Username for LaBB-CAT.
-
setUsername
@Switch("Username for LaBB-CAT.") public CommandLine setUsername(String newUsername)Setter forusername: 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 forpassword: Password for LaBB-CAT.- Returns:
- Password for LaBB-CAT.
-
setPassword
@Switch("Password for LaBB-CAT.") public CommandLine setPassword(String newPassword)Setter forpassword: 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 forverbose: Whether to produce verbose logging.- Returns:
- Whether to produce verbose logging.
-
setVerbose
@Switch("Whether to produce verbose logging.") public CommandLine setVerbose(Boolean newVerbose)Setter forverbose: 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 forindent: 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 forindent: 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
-
-