fetch the latest kernel info
This commit is contained in:
parent
aded5c0aff
commit
9c9ce943a9
1 changed files with 13 additions and 0 deletions
13
plugins/kernel.py
Normal file
13
plugins/kernel.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
from util import hook, http
|
||||
import re
|
||||
|
||||
@hook.command(autohelp=False)
|
||||
def kernel(inp, reply=None):
|
||||
contents = http.get("https://www.kernel.org/finger_banner")
|
||||
contents = re.sub(r'The latest(\s*)', '', contents)
|
||||
contents = re.sub(r'version of the Linux kernel is:(\s*)', '- ', contents)
|
||||
lines = contents.split("\n")
|
||||
|
||||
message = "Linux kernel versions: "
|
||||
message += ", ".join(line for line in lines[:-1])
|
||||
reply(message)
|
Reference in a new issue