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) + ) +