Add a limit in number of history lines
[kamaki] / kamaki / cli / commands / history.py
index 3b735b5..1142113 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2012-2013 GRNET S.A. All rights reserved.
+# Copyright 2012-2014 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -68,8 +68,9 @@ class history_show(_init_history):
 
     @errors.generic.all
     def _run(self, cmd_slice):
-        lines = ['%s.\t%s' % (i, l) for i, l in enumerate(self.history[:])][
-            cmd_slice]
+        c = self.history.counter
+        lines = ['%s.\t%s' % (i + c, l) for i, l in enumerate(
+            self.history[:])][cmd_slice]
         if not isinstance(cmd_slice, slice):
             lines = [lines, ]
         if self['match']: