findOrSetObject

inline fun <T : Any> BaseCliktCommand<*>.findOrSetObject(key: String = Context.DEFAULT_OBJ_KEY, crossinline default: () -> T): ReadOnlyProperty<BaseCliktCommand<*>, T>

Find the closest object of type T, setting context.obj if one is not found.

Note that this function returns a delegate, and so the object will not be set on the context until the delegated property's value is accessed. If you want to set a value for subcommands without accessing the property, call Context.findOrSetObject in your run function instead.