mirror of
https://codeberg.org/privacy1st/exec-notify
synced 2024-12-22 23:16:04 +01:00
minor
This commit is contained in:
parent
b53c282509
commit
3ba46f24fe
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ __pycache__/
|
||||
|
||||
/dist/
|
||||
/src/de.p1st.exec_notify.egg-info/
|
||||
/build/
|
||||
|
1
.idea/execNotify.iml
generated
1
.idea/execNotify.iml
generated
@ -7,6 +7,7 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/src/de_p1st_execNotify.egg-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/mail" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/src/de.p1st.exec_notify.egg-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (venv-310)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
# print(sys.path)
|
||||
from sys import argv
|
||||
import socket
|
||||
from typing import List
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import argv, stderr, stdin
|
||||
import sys
|
||||
# print(sys.path)
|
||||
import socket
|
||||
|
||||
from de.p1st.exec_notify.lib import mail
|
||||
@ -23,18 +24,18 @@ def main():
|
||||
subj = None
|
||||
hostname = socket.gethostname()
|
||||
|
||||
if len(argv) > 3:
|
||||
print('execNotify>> Expected at most two arguments!', file=stderr)
|
||||
if len(sys.argv) > 3:
|
||||
print('execNotify>> Expected at most two arguments!', file=sys.stderr)
|
||||
exit(1)
|
||||
if len(argv) == 2 or len(argv) == 3:
|
||||
subj = argv[1]
|
||||
if len(argv) == 3:
|
||||
BODY = argv[2]
|
||||
if len(sys.argv) == 2 or len(sys.argv) == 3:
|
||||
subj = sys.argv[1]
|
||||
if len(sys.argv) == 3:
|
||||
BODY = sys.argv[2]
|
||||
|
||||
if subj is None:
|
||||
subj = 'notify'
|
||||
if BODY is None:
|
||||
BODY = stdin.read()
|
||||
BODY = sys.stdin.read()
|
||||
|
||||
SUBJECT = f'{hostname} | {subj}'
|
||||
print(SUBJECT)
|
||||
|
Loading…
Reference in New Issue
Block a user