Add command line option "-c" (or "--colors") to display default colors in terminal

This commit is contained in:
Sebastien Helleu 2010-12-17 12:27:51 +01:00
parent 4043ca3d38
commit e80d6b93a5
19 changed files with 234 additions and 42 deletions

View File

@ -281,6 +281,10 @@ Befehlszeile:
-a, --no-connect::
deaktiviert das automatische Verbinden mit den Servern beim Start von WeeChat
// TRANSLATION MISSING
-c, --colors::
Display default colors in terminal
-d, --dir 'path'::
legt den Konfigurationsordner für WeeChat fest (Voreinstellung: ~/.weechat) in
dem die Erweiterungen, Skripten, Protokolldateien etc.pp. gesichert werden.

View File

@ -283,6 +283,9 @@ Command line arguments:
-a, --no-connect::
Disable auto-connect to servers when WeeChat is starting
-c, --colors::
Display default colors in terminal
-d, --dir 'path'::
Set path as home for WeeChat (used for configuration files, logs, user
plugins and scripts), default value is '~/.weechat' (note: directory is

View File

@ -289,6 +289,9 @@ Paramètres de ligne de commande :
-a, --no-connect::
Supprimer la connexion automatique aux serveurs lors du démarrage
-c, --colors::
Afficher les couleurs par défaut du terminal
-d, --dir 'path'::
Définir le répertoire comme étant la base de WeeChat
(utilisé pour les fichiers de configuration, logs, extensions

View File

@ -290,6 +290,10 @@ Argomenti a riga di comando:
-a, --no-connect::
Disabilita la connessione automatica ai server all'avvio di WeeChat
// TRANSLATION MISSING
-c, --colors::
Display default colors in terminal
-d, --dir 'path'::
Imposta una cartella come home per WeeChat (utilizzata per i file di
configurazione, log, plugin e script dell'utente), il valore predefinito

View File

@ -23,6 +23,10 @@ It is compliant with IRC RFCs 1459, 2810, 2811, 2812, and 2813.
.br
disable auto-connect to servers at startup
.TP
.B \-c, \-\-colors
.br
display default colors in terminal
.TP
.B \-d, \-\-dir <dir>
.br
set WeeChat home dir

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-11-06 11:55+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -43,8 +43,10 @@ msgstr ""
msgid "Usage: %s [option...] [plugin:option...]\n"
msgstr "Použití: %s [volba...] [plugin:volba...]\n"
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2527,6 +2529,16 @@ msgstr ""
"čtení - špatný podpis (formát aktualizačního souboru se mohl změnit od "
"poslední verze)"
msgid "Terminal infos:"
msgstr "Informace o terminálu:"
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Výchozí klávesové zkratky obnoveny"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminál ztracen, ukončuji WeeChat..."
@ -2537,9 +2549,6 @@ msgstr "Obdržen signál %s, ukončuji WeeChat.."
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "Obdržen signál SIGHUP, znovunačítám konfigurační soubory"
msgid "Terminal infos:"
msgstr "Informace o terminálu:"
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', velikost: %dx%d"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.3-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-12-07 23:21+0100\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -47,8 +47,10 @@ msgstr ""
msgid "Usage: %s [option...] [plugin:option...]\n"
msgstr "Aufruf: %s [Option...] [Erweiterung:Option...]\n"
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2637,6 +2639,16 @@ msgstr ""
"lese - falsche Signatur (das Dateiformat wurde vermutlich seit der letzten "
"Version verändern)"
msgid "Terminal infos:"
msgstr "Terminal Informationen:"
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Standard rmodifier:"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal verloren, beende WeeChat..."
@ -2647,9 +2659,6 @@ msgstr "Signal %s empfangen, beende WeeChat..."
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "Signal SIGHUP empfangen, lese Konfigurationsdateien neu"
msgid "Terminal infos:"
msgstr "Terminal Informationen:"
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', Größe: %dx%d"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -44,8 +44,10 @@ msgstr ""
msgid "Usage: %s [option...] [plugin:option...]\n"
msgstr "Uso: %s [opción...] [plugin:opción...]\n"
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2560,6 +2562,16 @@ msgstr ""
"lectura - firma incorrecta (el formato del archivo de actualización puede "
"haber cambiado desde la última versión)"
msgid "Terminal infos:"
msgstr "Información de la terminal:"
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Atajos predefinidos restaurados"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Se perdió la terminal, cerrando WeeChat..."
@ -2570,9 +2582,6 @@ msgstr "Señal %s recibida, cerrando WeeChat..."
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "Señal SIGHUP recibida, recargando archivos de configuración"
msgid "Terminal infos:"
msgstr "Información de la terminal:"
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', tamaño: %dx%d"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"PO-Revision-Date: 2010-12-09 20:22+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-12-17 11:58+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -46,6 +46,7 @@ msgstr "Utilisation: %s [option...] [extension:option...]\n"
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -62,6 +63,7 @@ msgid ""
" about possible options)\n"
msgstr ""
" -a, --no-connect désactiver l'auto-connexion aux serveurs au démarrage\n"
" -c, --colors afficher les couleurs par défaut du terminal\n"
" -d, --dir <rep> définir le répertoire de base pour WeeChat (défaut: ~/."
"weechat)\n"
" -h, --help cette aide\n"
@ -2598,6 +2600,15 @@ msgstr ""
"lecture - mauvaise signature (le format de fichier upgrade a peut-être "
"changé depuis la dernière version)"
msgid "Terminal infos:"
msgstr "Infos sur le terminal:"
msgid "No color support in terminal."
msgstr "Pas de support pour la couleur dans le terminal."
msgid "Default colors:"
msgstr "Couleurs par défaut:"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal perdu, sortie de WeeChat..."
@ -2608,9 +2619,6 @@ msgstr "Signal %s reçu, sortie de WeeChat..."
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "Signal SIGHUP reçu, rechargement des fichiers de configuration"
msgid "Terminal infos:"
msgstr "Infos sur le terminal:"
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', taille: %dx%d"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -46,6 +46,7 @@ msgstr ""
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2364,6 +2365,16 @@ msgid ""
"version)"
msgstr ""
msgid "Terminal infos:"
msgstr ""
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Alapértelmezett billentyűparancsok visszaállítva\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@ -2375,9 +2386,6 @@ msgstr ""
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "%s nem sikerült a konfigurációs fájlt elmenteni\n"
msgid "Terminal infos:"
msgstr ""
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-11 12:39+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-12-10 14:11+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -43,8 +43,10 @@ msgstr ""
msgid "Usage: %s [option...] [plugin:option...]\n"
msgstr "Utilizzo: %s [opzione...] [plugin:opzione...]\n"
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2574,6 +2576,16 @@ msgstr ""
"lettura - firma errata (l'aggiornamento del formato del file potrebbe essere "
"cambiato dall'ultima versione)"
msgid "Terminal infos:"
msgstr "Informazioni sul terminale:"
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Rmodifier predefiniti:"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminale perduto, chiusura di WeeChat..."
@ -2584,9 +2596,6 @@ msgstr "Ricevuto segnale %s, chiusura di WeeChat..."
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "Ricevuto segnale SIGHUP, caricamento dei file di configurazione"
msgid "Terminal infos:"
msgstr "Informazioni sul terminale:"
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', dimensione %dx%d"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -45,8 +45,10 @@ msgstr ""
msgid "Usage: %s [option...] [plugin:option...]\n"
msgstr "Użycie: %s [argumenty...] [wtyczka:opcje...]\n"
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2556,6 +2558,16 @@ msgid ""
msgstr ""
"odczyt - zła sygnatura (format pliku mógł ulec zmianie od poprzedniej wersji)"
msgid "Terminal infos:"
msgstr "Informacje terminala:"
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Przywrócono domyślne przypisania klawiszy"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Utracono terminal, wychodzę z WeeChat..."
@ -2566,9 +2578,6 @@ msgstr "Otrzymano sygnał %s, wychodzę z WeeChat..."
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "Otrzymano sygnał SIGHUP, przeładowuję pliki konfiguracyjne"
msgid "Terminal infos:"
msgstr "Informacje terminala:"
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', rozmiar: %dx%d"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-11-13 09:26+0100\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -43,8 +43,10 @@ msgstr ""
msgid "Usage: %s [option...] [plugin:option...]\n"
msgstr "Uso: %s [opção...] [plugin:opção...]\n"
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2083,6 +2085,16 @@ msgid ""
"version)"
msgstr ""
msgid "Terminal infos:"
msgstr ""
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "comando padrão:"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@ -2093,9 +2105,6 @@ msgstr ""
msgid "Signal SIGHUP received, reloading configuration files"
msgstr ""
msgid "Terminal infos:"
msgstr ""
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.4-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -48,6 +48,7 @@ msgstr ""
#, fuzzy
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2380,6 +2381,16 @@ msgid ""
"version)"
msgstr ""
msgid "Terminal infos:"
msgstr ""
msgid "No color support in terminal."
msgstr ""
#, fuzzy
msgid "Default colors:"
msgstr "Комбинации клавиш по умолчанию восстановлены\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@ -2391,9 +2402,6 @@ msgstr ""
msgid "Signal SIGHUP received, reloading configuration files"
msgstr "%s не могу сохранить конфигурационный файл\n"
msgid "Terminal infos:"
msgstr ""
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-12-09 22:59+0100\n"
"POT-Creation-Date: 2010-12-17 12:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -30,6 +30,7 @@ msgstr ""
msgid ""
" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -2023,6 +2024,15 @@ msgid ""
"version)"
msgstr ""
msgid "Terminal infos:"
msgstr ""
msgid "No color support in terminal."
msgstr ""
msgid "Default colors:"
msgstr ""
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@ -2033,9 +2043,6 @@ msgstr ""
msgid "Signal SIGHUP received, reloading configuration files"
msgstr ""
msgid "Terminal infos:"
msgstr ""
#, c-format
msgid " TERM='%s', size: %dx%d"
msgstr ""

View File

@ -110,6 +110,7 @@ weechat_display_usage (char *exec_name)
string_iconv_fprintf (stdout, "\n\n");
string_iconv_fprintf (stdout,
_(" -a, --no-connect disable auto-connect to servers at startup\n"
" -c, --colors display default colors in terminal\n"
" -d, --dir <path> set WeeChat home directory (default: ~/.weechat)\n"
" -h, --help this help\n"
" -k, --keys display WeeChat default keys\n"
@ -173,7 +174,13 @@ weechat_parse_args (int argc, char *argv[])
for (i = 1; i < argc; i++)
{
if ((strcmp (argv[i], "-d") == 0)
if ((strcmp (argv[i], "-c") == 0)
|| (strcmp (argv[i], "--colors") == 0))
{
gui_color_display_terminal_colors ();
weechat_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-d") == 0)
|| (strcmp (argv[i], "--dir") == 0))
{
if (i + 1 < argc)

View File

@ -326,6 +326,75 @@ gui_color_init ()
gui_color_init_weechat ();
}
/*
* gui_color_display_terminal_colors: display terminal colors
* This is called by command line option
* "-c" / "--colors"
*/
void
gui_color_display_terminal_colors ()
{
int lines, line, col, color;
int color_support, colors, color_pairs, change_color;
char str_line[1024], str_color[64];
color_support = 0;
colors = 0;
color_pairs = 0;
change_color = 0;
initscr ();
if (has_colors ())
{
color_support = 1;
start_color ();
use_default_colors ();
colors = COLORS;
color_pairs = COLOR_PAIRS;
change_color = can_change_color () ? 1 : 0;
refresh ();
endwin ();
}
printf ("\n");
printf ("%s $TERM=%s COLORS: %d, COLOR_PAIRS: %d, "
"can_change_color: %s\n",
_("Terminal infos:"),
getenv ("TERM"), colors, color_pairs,
(change_color) ? "yes" : "no");
if (colors == 0)
{
printf ("%s\n", _("No color support in terminal."));
}
else
{
printf ("\n");
printf ("%s\n", _("Default colors:"));
printf ("------------------------------------------------------------"
"--------------------\n");
lines = (colors < 16) ? colors : 16;
for (line = 0; line < lines; line++)
{
str_line[0] = '\0';
for (col = 0; col < 16; col++)
{
color = (col * 16) + line;
if (color < colors)
{
snprintf (str_color, sizeof (str_color),
"\33[0;38;5;%dm %03d ", color, color);
strcat (str_line, str_color);
}
}
printf ("%s\n", str_line);
}
printf ("\33[0m");
printf ("------------------------------------------------------------"
"--------------------\n");
}
printf ("\n");
}
/*
* gui_color_end: end GUI colors
*/

View File

@ -215,6 +215,18 @@ gui_color_init ()
gui_color_init_weechat ();
}
/*
* gui_color_display_terminal_colors: display terminal colors
* This is called by command line option
* "-c" / "--colors"
*/
void
gui_color_display_terminal_colors ()
{
/* This function does nothing in Gtk GUI */
}
/*
* gui_color_end: end GUI colors
*/

View File

@ -144,5 +144,6 @@ extern int gui_color_get_number ();
extern const char *gui_color_get_name (int num_color);
extern void gui_color_init_pairs ();
extern void gui_color_init_weechat ();
extern void gui_color_display_terminal_colors ();
#endif /* __WEECHAT_GUI_COLOR_H */