diff --git a/share/actionsmap.yml b/share/actionsmap.yml old mode 100644 new mode 100755 index a98653551..bedf0841c --- a/share/actionsmap.yml +++ b/share/actionsmap.yml @@ -1976,7 +1976,7 @@ log: - display arguments: path: - help: Log file which to display the content + help: Log file which to display the content, or 'last' or 'last-X' to get the log in last-X position -n: full: --number help: Number of lines to display diff --git a/src/log.py b/src/log.py old mode 100644 new mode 100755 index fd7c62635..eb513e545 --- a/src/log.py +++ b/src/log.py @@ -173,6 +173,16 @@ def log_show( share """ + match_path = re.match(r"last(?:-(?P[0-9]{1,6}))?$", path) + + if match_path: + if match_path.group("position") == None: + position = 1 + else: + position = int(match_path.group("position")) + 1 + logs = log_list() + path = list(logs["operation"])[-position]["path"] + if share: filter_irrelevant = True