Add pr_number helper
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):
