RT 4.4.4 Documentation

RT::Interface::CLI

Go to latest version →

NAME

  RT::Interface::CLI - helper functions for creating a commandline RT interface

SYNOPSIS

  use lib "/opt/rt4/local/lib", "/opt/rt4/lib";

  use RT::Interface::CLI  qw(GetCurrentUser Init loc);

  # Process command-line arguments, load the configuration, and connect
  # to the database
  Init();

  # Get the current user all loaded
  my $CurrentUser = GetCurrentUser();

  print loc('Hello!'); # Synonym of $CurrentUser->loc('Hello!');

DESCRIPTION

METHODS

GetCurrentUser

  Figures out the uid of the current user and returns an RT::CurrentUser object
loaded with that user.  if the current user isn't found, returns a copy of RT::Nobody.

loc

  Synonym of $CurrentUser->loc().

Init

A shim for "GetOptions" in Getopt::Long which automatically adds a --help option if it is not supplied. It then calls "LoadConfig" in RT and "Init" in RT.

It sets the LogToSTDERR setting to warning, to ensure that the user sees all relevant warnings. It also adds --quiet and --verbose options, which adjust the LogToSTDERR value to error or debug, respectively.

If debug is provided as a parameter, it added as an alias for --verbose.

← Back to index