From 7572699e55653b2f846bc0311ecbec51cd4a9532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 3 Aug 2018 13:40:34 +0200 Subject: [PATCH] Start working on something better than == for history checks --- lib/tfw/components/commands_equal.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/tfw/components/commands_equal.py diff --git a/lib/tfw/components/commands_equal.py b/lib/tfw/components/commands_equal.py new file mode 100644 index 0000000..713d227 --- /dev/null +++ b/lib/tfw/components/commands_equal.py @@ -0,0 +1,19 @@ +# Copyright (C) 2018 Avatao.com Innovative Learning Kft. +# All Rights Reserved. See LICENSE file for details. + +from shlex import split + + +class CommandsEqual: + def __init__(self, command_1, command_2): + self.command_1 = command_1 + self.command_2 = command_2 + + def __bool__(self): + parts_1 = split(self.command_1) + parts_2 = split(self.command_2) + return ( + parts_1[0] == parts_2[0] + and set(parts_1) == set(parts_2) + ) +