"""
syslog2irc.config
~~~~~~~~~~~~~~~~~

Configuration loading

:Copyright: 2007-2021 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""

from itertools import chain

from .irc import IrcConfig


def assemble_irc_config(args, routes):
    """Assemble IRC configuration from command line arguments and routes."""
    channels = list(chain(*routes.values()))

    return IrcConfig(
        server=args.irc_server,
        nickname=args.irc_nickname,
        realname=args.irc_realname,
        channels=channels,
    )

@@ -319,24 +319,31 @@
 tes.%22%22%22%0A    
+unique_
 channels = l
@@ -345,11 +345,10 @@
 s = 
-li
 s
+e
 t(ch
@@ -369,16 +369,91 @@
 lues()))
+%0A    ordered_channels = list(sorted(unique_channels, key=lambda c: c.name))
 %0A%0A    re
@@ -589,16 +589,24 @@
 hannels=
+ordered_
 channels

Add only unique channels to IRC config