##// END OF EJS Templates
add --keep alias for history trim
Paul Ivanov -
Show More
@@ -30,10 +30,14 b' class HistoryTrim(BaseIPythonApplication):'
30
30
31 flags = Dict(dict(
31 flags = Dict(dict(
32 backup = ({'HistoryTrim' : {'backup' : True}},
32 backup = ({'HistoryTrim' : {'backup' : True}},
33 "Keep the old history file as history.sqlite.<N>"
33 backup.get_metadata('help')
34 )
34 )
35 ))
35 ))
36
36
37 aliases=Dict(dict(
38 keep = 'HistoryTrim.keep'
39 ))
40
37 def start(self):
41 def start(self):
38 profile_dir = self.profile_dir.location
42 profile_dir = self.profile_dir.location
39 hist_file = os.path.join(profile_dir, 'history.sqlite')
43 hist_file = os.path.join(profile_dir, 'history.sqlite')
@@ -44,7 +48,7 b' class HistoryTrim(BaseIPythonApplication):'
44 'history ORDER BY session DESC, line DESC LIMIT ?', (self.keep+1,)))
48 'history ORDER BY session DESC, line DESC LIMIT ?', (self.keep+1,)))
45 if len(inputs) <= self.keep:
49 if len(inputs) <= self.keep:
46 print("There are already at most %d entries in the history database." % self.keep)
50 print("There are already at most %d entries in the history database." % self.keep)
47 print("Not doing anything.")
51 print("Not doing anything. Use --keep= argument to keep fewer entries")
48 return
52 return
49
53
50 print("Trimming history to the most recent %d entries." % self.keep)
54 print("Trimming history to the most recent %d entries." % self.keep)
General Comments 0
You need to be logged in to leave comments. Login now