iotile.core.scripts.iotile_script

Module Contents

DESCRIPTION = Create an interactive shell that explores the IOTile API.

This tool allows you to run commands that are defined in either CoreTools, or in a registered plugin. You can do things like build IOTile firmware or control an IOTile device.

If you wish enable logging to debug something that is not working correctly, you can do so by passing a combination of -v, -l, -e and -i flags as needed. See iotile –help for more details.

NB, if you want to pass global arguments to enable logging you must do so before the first command you pass otherwise the global arguments will be interpreted as arguments to your commands.

timeout_thread_handler(timeout, stop_event)

A background thread to kill the process if it takes too long.

Args:
timeout (float): The number of seconds to wait before killing
the process.
stop_event (Event): An optional event to cleanly stop the background
thread if required during testing.
create_parser()

Create the argument parser for iotile.

parse_global_args(argv)

Parse all global iotile tool arguments.

Any flag based argument at the start of the command line is considered as a global flag and parsed. The first non flag argument starts the commands that are passed to the underlying hierarchical shell.

Args:
argv (list): The command line for this command
Returns:
Namespace: The parsed arguments, with all of the commands that should
be executed in an iotile shell as the attribute ‘commands’
setup_completion(shell)

Setup readline to tab complete in a cross platform way.

main(argv=None)

Run the iotile shell tool.

You can optionally pass the arguments that should be run in the argv parameter. If nothing is passed, the args are pulled from sys.argv.

The return value of this function is the return value of the shell command.