1
0
mirror of https://github.com/HorlogeSkynet/archey4 synced 2025-05-05 20:00:12 +02:00

[UPTIME] Minor fixes on comments & uptime regex

This commit is contained in:
Michael Bromilow 2020-05-08 23:10:53 +01:00
parent 8b6ecb89fc
commit 53d5d9f181
No known key found for this signature in database
GPG Key ID: 0F937D40CE5F9F0F

@ -108,7 +108,6 @@ class Uptime(Entry):
except FileNotFoundError:
# No `uptime` command.
# Since `procps` is a dependency (which provides `uptime`) we can just exit here.
# Note: We _should_ not got there as `Processes` first check `procps` availability.
sys.exit("Please, install first `procps` (or `procps-ng`) on your system.")
# Unfortunately the output is not designed to be machine-readable...
@ -131,7 +130,7 @@ class Uptime(Entry):
(?: # non-capture group for hours:minutes colon or 'hrs' text
: # i.e. hours followed by either a single colon
| # OR
\s+?hrs # one or more whitespace chars non-greedily, followed by 'hrs'
\s+?hrs? # one or more whitespace chars non-greedily followed by 'hr' or 'hrs'
)
)? # match the hours non-capture group 0 or 1 times
(?: # non-capture group for minutes
@ -140,7 +139,7 @@ class Uptime(Entry):
)
(?: # non-capture group for 'min' or 'mins' text
\s+? # match whitespace,
mins? # followed by 'min' or 'mins
mins? # followed by 'min' or 'mins'
)? # match the 'mins' text non-capture group 0 or 1 times,
)? # the minutes non-capture group 0 or 1 times
)? # and the entire hours & minutes non-capture group 0 or 1 times