getShell function

IShell getShell(
  1. SmartArg context
)

Gets the IShell instance for the current SmartArg context. If not found, the SmartArg.parent will be recursively searched until a ChassisForge instance is found.

since 1.2.0

Implementation

IShell getShell(SmartArg context) {
  if (context is ChassisForge) {
    return context._shell;
  }
  if (context.parent != null) {
    return getShell(context.parent!);
  } else {
    throw Exception('Unable to find IShell instance in Command hierarchy');
  }
}