def main(opts):
    try:
        # Load a context with initialization
        ctx = Context.load(opts.workspace, strict=True)

        # Initialize the workspace if necessary
        if ctx:
            print('Catkin workspace `%s` is already initialized. No action taken.' % (ctx.workspace))
        else:
            print('Initializing catkin workspace in `%s`.' % (opts.workspace or os.getcwd()))
            # initialize the workspace
            init_metadata_root(
                opts.workspace or os.getcwd(),
                opts.reset)

        ctx = Context.load(opts.workspace)
        print(ctx.summary())

    except __HOLE__ as exc:
        # Usually happens if workspace is already underneath another catkin_tools workspace
        print('error: could not initialize catkin workspace: %s' % exc.message)
        return 1

    return 0
dataset/ETHPy150Open catkin/catkin_tools/catkin_tools/verbs/catkin_init/cli.py/main