Mercurial > hg > egg-tcls
changeset 174:d94be9a1be6a
weather: Add support for listing currently defined aliases.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 03 Jun 2014 13:00:38 +0300 |
parents | 3ea14355e2d4 |
children | bbab8c79dd95 |
files | weather.tcl |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)