default to only configured addons

This commit is contained in:
əlemi 2022-04-18 21:45:02 +02:00
parent aebe8c1965
commit 28f84ca095
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -66,7 +66,7 @@ def main():
parser.add_argument('--addon-path', dest='path', default='', help='path for loading addons') parser.add_argument('--addon-path', dest='path', default='', help='path for loading addons')
parser.add_argument('--chat-log', dest='chat_log', action='store_const', const=True, default=False, help="print (colored) chat to terminal") parser.add_argument('--chat-log', dest='chat_log', action='store_const', const=True, default=False, help="print (colored) chat to terminal")
parser.add_argument('--chat-input', dest='chat_input', action='store_const', const=True, default=False, help="read input from stdin and send it to chat") parser.add_argument('--chat-input', dest='chat_input', action='store_const', const=True, default=False, help="read input from stdin and send it to chat")
parser.add_argument('--addons', dest='add', nargs='+', type=str, default=[a.__name__ for a in addons], help='specify addons to enable, defaults to all') parser.add_argument('--addons', dest='add', nargs='+', type=str, default=None, help='specify addons to enable, defaults to all')
# TODO find a better way to specify which addons are enabled # TODO find a better way to specify which addons are enabled
args = parser.parse_args() args = parser.parse_args()
@ -86,7 +86,12 @@ def main():
use_packet_whitelist=args.use_packet_whitelist, use_packet_whitelist=args.use_packet_whitelist,
) )
enabled_addons = set(a.lower() for a in args.add) enabled_addons = set(
a.lower() for a in (
args.add if args.add is not None else client.config.sections()
)
)
for addon in addons: for addon in addons:
if addon.__name__.lower() in enabled_addons: if addon.__name__.lower() in enabled_addons:
logging.info("Installing '%s'", addon.__name__) logging.info("Installing '%s'", addon.__name__)