tcgui icon indicating copy to clipboard operation
tcgui copied to clipboard

Interface Sorting

Open shawndcorn opened this issue 2 years ago • 1 comments

I have a number of VLAN interfaces and they were always out of order. I fixed it by modifying the get_active_rules() with the following sort method: rules.sort(key=lambda x: x["name"]) Now all my interfaces are in alphabetical order. I'm not sure of the proper etiquette for incorporating that change to the main branch, so I figured I would just post it here.

def get_active_rules(): proc = subprocess.Popen(["tc", "qdisc"], stdout=subprocess.PIPE) output = proc.communicate()[0].decode() lines = output.split("\n")[:-1] rules = [] dev = set() for line in lines: arguments = line.split() rule = parse_rule(arguments) if rule["name"] and rule["name"] not in dev: rules.append(rule) dev.add(rule["name"]) rules.sort(key=lambda x: x["name"]) return rules

shawndcorn avatar Sep 27 '22 05:09 shawndcorn

Hello @shawndcorn. Thanks for the issue, I have created a merge request with your modification. Should it be accepted by the repo owner, your change will be officially in the app. Have a great day.

ncareau avatar Oct 28 '22 02:10 ncareau