Skip to content

Printing output, warnings and errors from a script

Svein Arne Ackenhausen edited this page May 10, 2014 · 1 revision

There are three types of visible output that you can print from a script: normal text, warnings and errors. Here is how to print them

This sample is in python as I enjoy using python. You can use any language you want

#!/usr/bin/env python
import sys

def print_definitions():
    print("Prints text, warnings and errors")

def run_command(run_location, global_profile, local_profile, args):
    print("Hello text!")
    print("warning|Hello warning!")
    print("error|Hello error!")

if __name__ == "__main__":
    args = sys.argv
    if len(args) > 1 and args[2] == 'get-command-definitions':
        print_definitions()
    else:
        run_command(args[1], args[2], args[3], args[4:])
Clone this wiki locally