code: public static CliCommandHierarchyImpl from(CommandHierarchyDef def) {
          // Create hierarchy with the parameter as the root.
          final CommandDirectoryDef rootDef = def.getRoot();
          final CliDirectory root = CliDirectory.fromDef(rootDef);
  
          // Create system commands 'virtual' directory.
          // System commands need to operate on an already built hierarchy, but... we are exactly in the process of building one.
          // In order to fully build a hierarchy, we must provide a set of system commands.
          // This is a cyclic dependency - resolved through the use of a 'promise' object, which will delegate all calls to the
          // concrete hierarchy, once it's built.
          final CliCommandHierarchyPromise hierarchyPromise = new CliCommandHierarchyPromise();
          final CliDirectory systemCommands = CliSystemCommandFactory.from(hierarchyPromise);
  
          // Update the 'promise' hierarchy with the concrete implementation.
          final CliCommandHierarchyImpl cliHierarchy = new CliCommandHierarchyImpl(root, systemCommands);
          hierarchyPromise.setDelegate(cliHierarchy);
          return cliHierarchy;
      }
docs: Construct a CLI hierarchy from a {@link CommandHierarchyDef}.
  
  @param def CommandHierarchyDef to construct a CLI hierarchy from.
  @return A CLI hierarchy constructed from the CommandHierarchyDef.