conf: Complete ordering functions for ConfigOption class

This commit is contained in:
Tobias Brunner 2020-01-29 13:23:57 +01:00
parent 1147973661
commit 48017a2740
1 changed files with 5 additions and 1 deletions

View File

@ -68,8 +68,9 @@ import sys
import re
from textwrap import TextWrapper
from argparse import ArgumentParser
from functools import cmp_to_key
from functools import cmp_to_key, total_ordering
@total_ordering
class ConfigOption:
"""Representing a configuration option or described section in strongswan.conf"""
def __init__(self, path, default = None, section = False, commented = False, include = False):
@ -83,6 +84,9 @@ class ConfigOption:
self.desc = []
self.options = []
def __eq__(self, other):
return self.name == other.name
def __lt__(self, other):
return self.name < other.name