mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
show_log: support names 'last' and 'last-x' in path
Co-authored-by: manor-tile <159947643+manor-tile@users.noreply.github.com>
This commit is contained in:
parent
df49295836
commit
f9d3ae1084
2 changed files with 11 additions and 1 deletions
2
share/actionsmap.yml
Normal file → Executable file
2
share/actionsmap.yml
Normal file → Executable file
|
@ -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
|
||||
|
|
10
src/log.py
Normal file → Executable file
10
src/log.py
Normal file → Executable file
|
@ -173,6 +173,16 @@ def log_show(
|
|||
share
|
||||
"""
|
||||
|
||||
match_path = re.match(r"last(?:-(?P<position>[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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue