def add(self, line, always=False):
        """
        Add a line to the history.
        :param line: line to add to history
        :type line: str
        :param always: always add this line, regardless of config
        :type always: bool
        """
        if self._current not in self._histories:
            self._histories[self._current] = []
        stripped = line.strip()
        last_line = (self._histories[self._current][-1] if len(self._histories[self._current]) > 0 else None)
        if not always:
            # check if this line should be added
            if stripped == last_line and not self.allow_double:
                # prevent double lines
                return
            if line.startswith(" ") and self.hide_whitespace:
                # hide lines starting with a whitespace
                return
        self._histories[self._current].append(stripped)
        # ensure maxsize
        while len(self._histories[self._current]) > max(0, self.maxsize):
            self._histories[self._current].pop(0)

        # reset index
        self.reset_idx()

        Add a line to the history.
        :param line: line to add to history
        :type line: str
        :param always: always add this line, regardless of config
        :type always: bool
        
system/shhistory.py