summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-10-26 21:58:01 +0100
committerjao <jao@gnu.org>2021-10-26 21:58:01 +0100
commit734a9f3d2163f9d4da7d8b59d68c3e1cecb45610 (patch)
treebb9bdeff32c47c4da06f3c25d876d996ac2784f5
parentd8e60ed296861200283772db606ad72d9b9fae8a (diff)
downloadelibs-734a9f3d2163f9d4da7d8b59d68c3e1cecb45610.tar.gz
elibs-734a9f3d2163f9d4da7d8b59d68c3e1cecb45610.tar.bz2
mullvad: any relays
-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)))))