summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshirenn <shirenn@crans.org>2022-05-14 08:20:38 +0200
committershirenn <shirenn@crans.org>2022-05-14 08:20:38 +0200
commit7706ce7f1a955b283f704fe38da159f090867406 (patch)
treeac716b26f8b528109ca7cc37954ed24f9755a90c
parentc338feb5248adfa96c23eaef5de7a72bef985d41 (diff)
downloadqutebrowser-7706ce7f1a955b283f704fe38da159f090867406.tar.gz
qutebrowser-7706ce7f1a955b283f704fe38da159f090867406.zip
[squash] Renames --minimal to --no-history
-rw-r--r--qutebrowser/misc/sessions.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py
index 7999802a3..f8842ca6b 100644
--- a/qutebrowser/misc/sessions.py
+++ b/qutebrowser/misc/sessions.py
@@ -242,7 +242,7 @@ class SessionManager(QObject):
return data
- def _save_tab(self, tab, active, minimal=False):
+ def _save_tab(self, tab, active, no_history=False):
"""Get a dict with data for a single tab.
Args:
@@ -253,7 +253,7 @@ class SessionManager(QObject):
if active:
data['active'] = True
- if minimal:
+ if no_history:
history = [tab.history.current_item()]
else:
history = tab.history
@@ -270,7 +270,7 @@ class SessionManager(QObject):
data['history'].append(item_data)
return data
- def _save_all(self, *, only_window=None, with_private=False, minimal=False):
+ def _save_all(self, *, only_window=None, with_private=False, no_history=False):
"""Get a dict with data for all windows/tabs."""
data: _JsonType = {'windows': []}
if only_window is not None:
@@ -301,7 +301,8 @@ class SessionManager(QObject):
win_data['private'] = True
for i, tab in enumerate(tabbed_browser.widgets()):
active = i == tabbed_browser.widget.currentIndex()
- win_data['tabs'].append(self._save_tab(tab, active, minimal=minimal))
+ win_data['tabs'].append(self._save_tab(tab, active,
+ no_history=no_history))
data['windows'].append(win_data)
return data
@@ -322,7 +323,7 @@ class SessionManager(QObject):
return name
def save(self, name, last_window=False, load_next_time=False,
- only_window=None, with_private=False, minimal=False):
+ only_window=None, with_private=False, no_history=False):
"""Save a named session.
Args:
@@ -333,7 +334,7 @@ class SessionManager(QObject):
load_next_time: If set, prepares this session to be load next time.
only_window: If set, only tabs in the specified window is saved.
with_private: Include private windows.
- minimal: Don't save tab history
+ no_history: Don't save tab history
Return:
The name of the saved session.
@@ -350,7 +351,7 @@ class SessionManager(QObject):
else:
data = self._save_all(only_window=only_window,
with_private=with_private,
- minimal=minimal)
+ no_history=no_history)
log.sessions.vdebug( # type: ignore[attr-defined]
"Saving data: {}".format(data))
try:
@@ -584,14 +585,14 @@ def session_load(name: str, *,
@cmdutils.argument('name', completion=miscmodels.session)
@cmdutils.argument('win_id', value=cmdutils.Value.win_id)
@cmdutils.argument('with_private', flag='p')
-@cmdutils.argument('minimal', flag='m')
+@cmdutils.argument('no_history', flag='n')
def session_save(name: ArgType = default, *,
current: bool = False,
quiet: bool = False,
force: bool = False,
only_active_window: bool = False,
with_private: bool = False,
- minimal: bool = False,
+ no_history: bool = False,
win_id: int = None) -> None:
"""Save a session.
@@ -603,7 +604,7 @@ def session_save(name: ArgType = default, *,
force: Force saving internal sessions (starting with an underline).
only_active_window: Saves only tabs of the currently active window.
with_private: Include private windows.
- minimal: Don't store tab history
+ no_history: Don't store tab history
"""
if not isinstance(name, Sentinel) and name.startswith('_') and not force:
raise cmdutils.CommandError("{} is an internal session, use --force "
@@ -617,10 +618,10 @@ def session_save(name: ArgType = default, *,
if only_active_window:
name = session_manager.save(name, only_window=win_id,
with_private=True,
- minimal=minimal)
+ no_history=no_history)
else:
name = session_manager.save(name, with_private=with_private,
- minimal=minimal)
+ no_history=no_history)
except SessionError as e:
raise cmdutils.CommandError("Error while saving session: {}".format(e))
else: