Show More
@@ -32,25 +32,21 b' This is an handy alias to `ipython history trim --keep=0`' | |||
|
32 | 32 | |
|
33 | 33 | class HistoryTrim(BaseIPythonApplication): |
|
34 | 34 | description = trim_hist_help |
|
35 | ||
|
36 | backup = Bool(False, | |
|
37 | help="Keep the old history file as history.sqlite.<N>" | |
|
38 | ).tag(config=True) | |
|
39 | ||
|
40 | keep = Int(1000, | |
|
41 | help="Number of recent lines to keep in the database." | |
|
42 | ).tag(config=True) | |
|
43 | ||
|
44 | flags = Dict(dict( | |
|
45 | backup = ({'HistoryTrim' : {'backup' : True}}, | |
|
46 | backup.help | |
|
47 | ) | |
|
48 | )) | |
|
49 | 35 | |
|
50 | aliases=Dict(dict( | |
|
51 | keep = 'HistoryTrim.keep' | |
|
52 |
) |
|
|
53 | ||
|
36 | backup = Bool(False, help="Keep the old history file as history.sqlite.<N>").tag( | |
|
37 | config=True | |
|
38 | ) | |
|
39 | ||
|
40 | keep = Int(1000, help="Number of recent lines to keep in the database.").tag( | |
|
41 | config=True | |
|
42 | ) | |
|
43 | ||
|
44 | flags = Dict( # type: ignore | |
|
45 | dict(backup=({"HistoryTrim": {"backup": True}}, backup.help)) | |
|
46 | ) | |
|
47 | ||
|
48 | aliases = Dict(dict(keep="HistoryTrim.keep")) # type: ignore | |
|
49 | ||
|
54 | 50 | def start(self): |
|
55 | 51 | profile_dir = Path(self.profile_dir.location) |
|
56 | 52 | hist_file = profile_dir / "history.sqlite" |
@@ -114,34 +110,33 b' class HistoryTrim(BaseIPythonApplication):' | |||
|
114 | 110 | print("Backed up longer history file to", backup_hist_file) |
|
115 | 111 | else: |
|
116 | 112 | hist_file.unlink() |
|
117 | ||
|
113 | ||
|
118 | 114 | new_hist_file.rename(hist_file) |
|
119 | 115 | |
|
116 | ||
|
120 | 117 | class HistoryClear(HistoryTrim): |
|
121 | 118 | description = clear_hist_help |
|
122 | keep = Int(0, | |
|
123 | help="Number of recent lines to keep in the database.") | |
|
124 | ||
|
125 | force = Bool(False, | |
|
126 | help="Don't prompt user for confirmation" | |
|
127 | ).tag(config=True) | |
|
128 | ||
|
129 | flags = Dict(dict( | |
|
130 | force = ({'HistoryClear' : {'force' : True}}, | |
|
131 | force.help), | |
|
132 | f = ({'HistoryTrim' : {'force' : True}}, | |
|
133 | force.help | |
|
119 | keep = Int(0, help="Number of recent lines to keep in the database.") | |
|
120 | ||
|
121 | force = Bool(False, help="Don't prompt user for confirmation").tag(config=True) | |
|
122 | ||
|
123 | flags = Dict( # type: ignore | |
|
124 | dict( | |
|
125 | force=({"HistoryClear": {"force": True}}, force.help), | |
|
126 | f=({"HistoryTrim": {"force": True}}, force.help), | |
|
134 | 127 | ) |
|
135 |
) |
|
|
136 | aliases = Dict() | |
|
128 | ) | |
|
129 | aliases = Dict() # type: ignore | |
|
137 | 130 | |
|
138 | 131 | def start(self): |
|
139 |
if self.force or ask_yes_no( |
|
|
140 |
default="no", interrupt="no" |
|
|
132 | if self.force or ask_yes_no( | |
|
133 | "Really delete all ipython history? ", default="no", interrupt="no" | |
|
134 | ): | |
|
141 | 135 | HistoryTrim.start(self) |
|
142 | 136 | |
|
137 | ||
|
143 | 138 | class HistoryApp(Application): |
|
144 |
name = |
|
|
139 | name = "ipython-history" | |
|
145 | 140 | description = "Manage the IPython history database." |
|
146 | 141 | |
|
147 | 142 | subcommands = Dict(dict( |
@@ -19,7 +19,6 b' exclude = [' | |||
|
19 | 19 | 'IPython/core/application.py', |
|
20 | 20 | 'IPython/core/completerlib.py', |
|
21 | 21 | 'IPython/core/displaypub.py', |
|
22 | 'IPython/core/historyapp.py', | |
|
23 | 22 | #'IPython/core/interactiveshell.py', |
|
24 | 23 | 'IPython/core/magic.py', |
|
25 | 24 | 'IPython/core/profileapp.py', |
@@ -30,8 +29,6 b' exclude = [' | |||
|
30 | 29 | 'IPython/terminal/ipapp.py', |
|
31 | 30 | 'IPython/utils/_process_win32.py', |
|
32 | 31 | 'IPython/utils/path.py', |
|
33 | 'IPython/utils/timing.py', | |
|
34 | 'IPython/utils/text.py' | |
|
35 | 32 | ] |
|
36 | 33 | |
|
37 | 34 | [tool.pytest.ini_options] |
General Comments 0
You need to be logged in to leave comments.
Login now