mirror of
https://github.com/unixtensor/proxmox-ntfy.git
synced 2025-06-28 13:08:05 +00:00
Implament sys.argv
with argparse
This commit is contained in:
24
src/cli.py
24
src/cli.py
@ -10,20 +10,14 @@ python3 main.py ntfy.domain.com\033[0m
|
||||
|
||||
Use \033[32m-h\033[0m or \033[32m--help\033[0m for a full list of options."""
|
||||
|
||||
class Interface:
|
||||
def __init__(self):
|
||||
self.parser = argparse.ArgumentParser()
|
||||
self.parser.add_argument("--cpu-temp-disabled", action="store_true", help="Disable notifications for CPU tempature.")
|
||||
self.parser.add_argument("--cpu-temp-critical", type=int, default=80, help="CPU tempature for the crtitical alert. default = 80")
|
||||
self.parser.add_argument("--cpu-temp-warning", type=int, default=70, help="CPU tempature for the warning alert. default = 70")
|
||||
self.parser.add_argument("--update-rate", type=int, default=1, help="How often updates happen in seconds. default = 1")
|
||||
def Interface():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("server_address", help="The ntfy server address.")
|
||||
|
||||
def parsed_args(self):
|
||||
return self.parser.parse_args()
|
||||
parser.add_argument("--disable-uptime-notifys", action="store_true", help="Disable uptime notifications.")
|
||||
parser.add_argument("--disable-cpu-temp", action="store_true", help="Disable notifications for CPU tempature.")
|
||||
parser.add_argument("--cpu-temp-critical", type=int, default=80, help="CPU tempature for the crtitical alert. default = 80")
|
||||
parser.add_argument("--cpu-temp-warning", type=int, default=70, help="CPU tempature for the warning alert. default = 70")
|
||||
parser.add_argument("--update-rate", type=int, default=1, help="How often updates happen in seconds. default = 1")
|
||||
|
||||
def argv_1(self) -> Optional[str]:
|
||||
if len(sys.argv) > 1:
|
||||
return sys.argv[1]
|
||||
else:
|
||||
print(_ntfy_configure_prompt)
|
||||
return None
|
||||
return parser.parse_args()
|
Reference in New Issue
Block a user