code: public static CliDirectory fromDef(CommandDirectoryDef def) {
          final Trie<CliDirectory> childDirectories = createChildDirectories(def);
          final Trie<CliCommand> childCommands = createChildCommands(def);
          final CliDirectory directory = new CliDirectory(def.getIdentifier(), childDirectories, childCommands);
  
          // Link child directories to parent.
          for (CliDirectory childDirectory : childDirectories.values()) {
              childDirectory.setParent(directory);
          }
          return directory;
      }
docs: Construct a CLI directory from a {@link CommandDirectoryDef}.
  
  @param def CommandDirectoryDef to construct a CLI directory from.
  @return A CLI directory constructed from the CommandDirectoryDef.