Repository: getnikola/nikola

Issue:
Running `nikola new_post --available-formats` in a new site throws a TypeError
### Environment

**Python Version:** Python 3.12.0

**Nikola Version:** Nikola v8.3.0

**Operating System:** macOS 13.6.3

### Description:

If I create a brand new Nikola site and run `nikola new_post --available-formats`, I get a TypeError rather than a list of formats.

Steps to reproduce:

```console
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install Nikola[extras]
[…output snippet]
$ nikola init --quiet mydemo
$ cd mydemo/
$ nikola new_post --available-formats
Traceback (most recent call last):
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/doit/doit_cmd.py", line 294, in run
    return command.parse_execute(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/doit/cmd_base.py", line 150, in parse_execute
    return self.execute(params, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/nikola/plugin_categories.py", line 131, in execute
    return self._execute(options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/nikola/plugins/command/new_post.py", line 247, in _execute
    self.print_compilers()
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/nikola/plugins/command/new_post.py", line 523, in print_compilers
    for name, (_, _, pi) in self.site.disabled_compilers.items():
              ^^^^^^^^^^
TypeError: cannot unpack non-iterable PluginCandidate object
```


Discussion:

Resolving patch:
diff --git a/nikola/plugin_manager.py b/nikola/plugin_manager.py
--- a/nikola/plugin_manager.py
+++ b/nikola/plugin_manager.py
@@ -59,6 +59,7 @@ class PluginCandidate:
 
     name: str
     description: Optional[str]
+    friendly_name: str
     plugin_id: str
     category: str
     compiler: Optional[str]
@@ -72,6 +73,7 @@ class PluginInfo:
 
     name: str
     description: Optional[str]
+    friendly_name: str
     plugin_id: str
     category: str
     compiler: Optional[str]
@@ -129,6 +131,7 @@ def locate_plugins(self) -> List[PluginCandidate]:
                 continue
             category = config["Nikola"].get("PluginCategory")
             compiler = config["Nikola"].get("Compiler")
+            friendly_name = config["Nikola"].get("friendlyname") or name
             if not category:
                 self.logger.warning(f"{plugin_id} does not specify any category (Nikola.PluginCategory is missing in .plugin file) - plugin will not be loaded")
                 self.has_warnings = True
@@ -144,6 +147,7 @@ def locate_plugins(self) -> List[PluginCandidate]:
                 PluginCandidate(
                     name=name,
                     description=description,
+                    friendly_name=friendly_name,
                     plugin_id=plugin_id,
                     category=category,
                     compiler=compiler,
@@ -225,6 +229,7 @@ def load_plugins(self, candidates: List[PluginCandidate]) -> None:
             info = PluginInfo(
                 name=name,
                 description=candidate.description,
+                friendly_name=candidate.friendly_name,
                 plugin_id=candidate.plugin_id,
                 category=candidate.category,
                 compiler=candidate.compiler,
diff --git a/nikola/plugins/command/new_post.py b/nikola/plugins/command/new_post.py
--- a/nikola/plugins/command/new_post.py
+++ b/nikola/plugins/command/new_post.py
@@ -520,22 +520,18 @@ def print_compilers(self):
                     False
                 ])
 
-        for name, (_, _, pi) in self.site.disabled_compilers.items():
-            if pi.details.has_option('Nikola', 'Friendlyname'):
-                f_name = pi.details.get('Nikola', 'Friendlyname')
-            else:
-                f_name = name
-            if name in compilers_raw:
+        for plugin in self.site.disabled_compilers.values():
+            if plugin.name in compilers_raw:
                 unused_compilers.append([
-                    name,
-                    f_name,
-                    compilers_raw[name],
+                    plugin.name,
+                    plugin.friendly_name,
+                    compilers_raw[plugin.name],
                     False
                 ])
             else:
                 disabled_compilers.append([
-                    name,
-                    f_name,
+                    plugin.name,
+                    plugin.friendly_name,
                     (),
                     False
                 ])


Test patch: