]> us-delaporte.pagekite.me Git - dotfiles.git/blobdiff - files/pc/tasks.py
Standardize URL approach
[dotfiles.git] / files / pc / tasks.py
index 6e145b8c0f478d8eaeff121519afca600b032c18..c2cb8e13d220b194dce4e74241125a416550915f 100644 (file)
@@ -6,13 +6,24 @@ import os
 
 HOME = os.path.expanduser('~')
 TODAY = dt.now().strftime('%Y.%m.%d')
-KIDS_ALLOWANCE_URL=os.environ.get('KIDS_ALLOWANCE_URL')
 PAYROLL = os.environ.get('PAYROLL')
-BUDGET_URL = os.environ.get('BUDGET_URL')
-CU_URL = os.environ.get('CU_URL')
 SCHOOL = f"{HOME}/School"
 PAYROLL = f"{HOME}/Nanny.Payroll"
 
+expect_URLs = [
+'budget',
+'cu',
+'allowance'
+]
+
+URLS = {}
+for url in expect_URLs:
+    key = f'URL_{url.upper()}'
+    result = os.environ.get(key)
+    if not result:
+        raise ValueError(f'Missing expected {key} in environment.')
+    URLS[url] = result
+
 def browse(c, url):
     c.run(f"librefox {url}", asynchronous=True)
 
@@ -24,6 +35,15 @@ def code(c, path):
 def folder(c, path):
     c.run(f"nemo {path}")
 
+@task
+def go(c, bookmark):
+    var = f'URL_{bookmark.upper()}'
+    url = os.environ.get(var)
+    browse(c, url)
+
+@task
+def cloud_panel(c):
+    go(c, 'cloud')
 
 @task
 def debug(c):
@@ -71,8 +91,7 @@ def debug(c):
 
 @task
 def allowance(c):
-    browse(c, KIDS_ALLOWANCE_URL)
-
+    browse(c, URLS['allowance'])
 
 @task
 def payroll(c):
@@ -136,3 +155,10 @@ def budget(c):
     browse(c, CU_URL)
 
 
+@task
+def get_drive_info(c):
+    # List non-squash, non-tmp drives.
+    c.run('df -x squashfs -x tmpfs')
+    c.run('ls /dev/disk/by-label')
+
+