BugzScout Command Line Interface

There is a command line interface for submitting errors. It can be used for non-python application (like shell scripts).

usage: bugzscout [-h] [-v] [-u URL] [--user USER] [--project PROJECT] [--area AREA]
                 [-e EXTRA] [--default-message DEFAULT_MESSAGE]

Command line interface for sumbitting cases to FogBugz via BugzScout.

Environment variables can be used to set the FogBugz arguments with:


optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Enable verbose output. (default: False)

FogBugz arguments:
  -u URL, --url URL     URL for bugzscout requests to be sent. Should be something like
                        .../scoutSubmit.asp. (default: None)
  --user USER           User to designate when submitting via bugzscout. (default: None)
  --project PROJECT     Fogbugz project to file cases under. (default: None)
  --area AREA           Fogbugz area to file cases under. (default: None)

error arguments:
  -e EXTRA, --extra EXTRA
                        Extra data to send with error. (default: None)
  --default-message DEFAULT_MESSAGE
                        Set default message if case is new. (default: None)
  description           Description of error. Will be matched against existing cases.

To simplify submitting multiple errors, the FogBugz configuration can be set in the environment.

# (Optional) Setup the environment.
export BUGZSCOUT_URL=http://fogbugz/scoutSubmit.asp
export BUGZSCOUT_USER=errors
export BUGZSCOUT_PROJECT='My Project'
export BUGZSCOUT_AREA=Errors

# Submit a new error.
bugzscout --extra 'Extra data for the case...' 'The description of the error.'

Example shell script using cli

Below is an example of a bash function that can wrap other bash calls. It reports an error to fogbugz if the call has a non-zero exit code.


# Setup the environment with FogBugz configuration.
export BUGZSCOUT_URL='http://fogbugz/scoutSubmit.asp'
export BUGZSCOUT_USER='error-user'
export BUGZSCOUT_PROJECT='MyShellScript'
export BUGZSCOUT_AREA='Errors'

this_node=$(hostname --fqdn)

function bugzscout_wrap()
    # The call is all the arguments to this function.
    local call=$@

    # Call the function.
    bash -c "${call}"
    local exit_code=$?

    # If non-zero exit code, report error.
    if [ "${exit_code}" != "0" ] ; then
        bugzscout "${call} in ${0} failed with exit code ${exit_code} on ${this_node}" \
            || /bin/true

    return $exit_code

For example, in a bash shell, the second line would fail and report an error via BugzScout:

source path/to/bugzscout_wrap_function.sh
bugzscout_wrap /bin/false

Project Versions

Table Of Contents

Previous topic


Next topic

Examples Uses of BugzScout

This Page