Revision 304c90b5 kamaki/cli/history.py

b/kamaki/cli/history.py
78 78

  
79 79
        :returns: (str) the stored command record without the id
80 80
        """
81
        cmd_id = int(cmd_id)
81 82
        with open(self.filepath) as f:
82
            for line in f.readlines():
83
                if line.startswith('%s ' % cmd_id):
84
                    return line[4:]
85
        return None
83
            try:
84
                return f.readlines()[cmd_id - 1]
85
            except IndexError:
86
                return None

Also available in: Unified diff