summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/net/jao-mullvad.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/net/jao-mullvad.el b/lib/net/jao-mullvad.el
index e4b335e..c76af33 100644
--- a/lib/net/jao-mullvad.el
+++ b/lib/net/jao-mullvad.el
@@ -113,10 +113,15 @@
"Choose a country and city and set them to the default relay location."
(interactive)
(let* ((cc (jao-mullvad--list))
- (country (completing-read "Country: " (mapcar #'car cc) nil t))
- (city (completing-read "City: " (cdr (assoc country cc #'string=))))
- (cntr (and (string-match "(\\(...?\\))" country) (match-string 1 country)))
- (code (and (string-match "(\\(...\\))" city) (match-string 1 city))))
+ (countries (cons "any" (mapcar #'car cc)))
+ (country (completing-read "Country: " countries nil t))
+ (cities (unless (string= "any" country)
+ (cons "any" (cdr (assoc country cc #'string=)))))
+ (city (if cities (completing-read "City: " cities nil t) "any"))
+ (cntr (if (string-match "(\\(...?\\))" country)
+ (match-string 1 country)
+ country))
+ (code (if (string-match "(\\(...\\))" city) (match-string 1 city) "")))
(when (y-or-n-p (format "Set location to %s / %s?" country city))
(jao-mullvad--do (format "relay set location %s %s" cntr code)))))