From 734a9f3d2163f9d4da7d8b59d68c3e1cecb45610 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 26 Oct 2021 21:58:01 +0100 Subject: mullvad: any relays --- lib/net/jao-mullvad.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/net') 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))))) -- cgit v1.2.3