# HG changeset patch # User Matti Hamalainen # Date 1401789638 -10800 # Node ID d94be9a1be6a7dded5eda009a64a714c47332398 # Parent 3ea14355e2d40036132e186f3f518b4eec1f0f26 weather: Add support for listing currently defined aliases. diff -r 3ea14355e2d4 -r d94be9a1be6a weather.tcl --- a/weather.tcl Tue Jun 03 13:00:13 2014 +0300 +++ b/weather.tcl Tue Jun 03 13:00:38 2014 +0300 @@ -40,6 +40,7 @@ set weather_msg_aliased "Aliasoitiin \002%1\002 = \002%2\002." set weather_msg_unaliased "Unaliasoitiin \002%1\002." +set weather_msg_aliases "Aliakset: %1" set weather_msg_user_not_known "Tuntematon käyttäjä." set weather_msg_no_access "Ei oikeuksia muuttaa asetuksia." @@ -298,7 +299,7 @@ global weather_msg_no_results weather_msg_no_data_for_location global weather_msg_usage_alias weather_msg_usage_unalias weather_msg_defloc global weather_msg_aliased weather_msg_unaliased weather_msg_no_access - global weather_msg_def_set weather_msg_def_not_set + global weather_msg_def_set weather_msg_def_not_set weather_msg_aliases # Check and handle arguments set rarglist [::textutil::split::splitx $uargs {\s+}] @@ -377,6 +378,14 @@ weather_save_aliases return 0 + } elseif {$rarg == "list"} { + # List all currently defined aliases + set ulist {} + foreach {ukey uvalue} [array get weather_aliases] { + lappend ulist "\002'$ukey' = '$uvalue'\002" + } + weather_msg $upublic $unick $uchan $weather_msg_aliases [list [join $ulist ", "]] + return 0 } # Get args or default location(s)