Add pr_number helper
MODIFY
plextraktsync/commands/self_update.py
plextraktsync/commands/self_update.py
from os import system
+from typing import Optional
import click
@@ -21,6 +22,22 @@ def has_previous_pr(pr: int):
return True
+def pr_number() -> Optional[int]:
+ """
+ Check if current executable is named plextraktsync@<pr>
+ """
+
+ import sys
+ try:
+ pr = sys.argv[0].split('@')[1]
+ except IndexError:
+ return None
+
+ if pr.isnumeric():
+ return int(pr)
+ return None
+
+
def self_update(pr: int):
if pr:
if has_previous_pr(pr):

Add pr_number helper