1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +02:00

Added --irc-commands and --weechat-commands command line options

This commit is contained in:
Sebastien Helleu
2005-03-10 15:40:18 +00:00
parent 5301c75021
commit 9fbd33faaf
6 changed files with 142 additions and 10 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-03-05
ChangeLog - 2005-03-10
Version 0.1.1 (under dev!):
@@ -9,6 +9,7 @@ Version 0.1.1 (under dev!):
* added new display engine: doesn't cut words at end of lines
* added DCC send and DCC chat
* added spanish translation
* added --irc-commands and --weechat-commands command line options
* connection to IRC server is now made by child process (non blocking)
* added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)
* new key for window switch (now: F5/F6=switch buffer, F7/F8=switch window)
+63
View File
@@ -247,6 +247,57 @@ void wee_display_config_options ()
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
}
/*
* wee_display_commands: display WeeChat and/or IRC commands
*/
void wee_display_commands (int weechat_cmd, int irc_cmd)
{
int i;
if (weechat_cmd)
{
printf (_("%s internal commands:\n"), PACKAGE_NAME);
printf ("\n");
for (i = 0; weechat_commands[i].command_name; i++)
{
printf ("* %s", weechat_commands[i].command_name);
if (weechat_commands[i].arguments &&
weechat_commands[i].arguments[0])
printf (" %s\n", _(weechat_commands[i].arguments));
else
printf ("\n");
if (weechat_commands[i].arguments_description &&
weechat_commands[i].arguments_description[0])
printf ("\n%s\n\n",
_(weechat_commands[i].arguments_description));
}
}
if (irc_cmd)
{
printf (_("IRC commands:\n"));
printf ("\n");
for (i = 0; irc_commands[i].command_name; i++)
{
if (irc_commands[i].cmd_function_args ||
irc_commands[i].cmd_function_1arg)
{
printf ("* %s", irc_commands[i].command_name);
if (irc_commands[i].arguments &&
irc_commands[i].arguments[0])
printf (" %s\n", _(irc_commands[i].arguments));
else
printf ("\n");
if (irc_commands[i].arguments_description &&
irc_commands[i].arguments_description[0])
printf ("\n%s\n\n",
_(irc_commands[i].arguments_description));
}
}
}
}
/*
* wee_parse_args: parse command line args
*/
@@ -274,6 +325,12 @@ wee_parse_args (int argc, char *argv[])
printf ("%s", WEE_USAGE2);
wee_shutdown (EXIT_SUCCESS);
}
if ((strcmp (argv[i], "-i") == 0)
|| (strcmp (argv[i], "--irc-commands") == 0))
{
wee_display_commands (0, 1);
wee_shutdown (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-l") == 0)
|| (strcmp (argv[i], "--license") == 0))
{
@@ -286,6 +343,12 @@ wee_parse_args (int argc, char *argv[])
printf (PACKAGE_VERSION "\n");
wee_shutdown (EXIT_SUCCESS);
}
if ((strcmp (argv[i], "-w") == 0)
|| (strcmp (argv[i], "--weechat-commands") == 0))
{
wee_display_commands (1, 0);
wee_shutdown (EXIT_SUCCESS);
}
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
{
if (server_init_with_url (argv[i], &server_tmp) < 0)
+6 -4
View File
@@ -81,10 +81,12 @@
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
#define WEE_USAGE2 \
" -c, --config config file help (list of options)\n" \
" -h, --help this help screen\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n\n"
" -c, --config display config file options\n" \
" -h, --help this help screen\n" \
" -i, --irc-commands display IRC commands\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n" \
" -w, --weechat-commands display WeeChat commands\n\n"
/* directory separator, depending on OS */
+2 -1
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-03-05
ChangeLog - 2005-03-10
Version 0.1.1 (under dev!):
@@ -9,6 +9,7 @@ Version 0.1.1 (under dev!):
* added new display engine: doesn't cut words at end of lines
* added DCC send and DCC chat
* added spanish translation
* added --irc-commands and --weechat-commands command line options
* connection to IRC server is now made by child process (non blocking)
* added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)
* new key for window switch (now: F5/F6=switch buffer, F7/F8=switch window)
+63
View File
@@ -247,6 +247,57 @@ void wee_display_config_options ()
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
}
/*
* wee_display_commands: display WeeChat and/or IRC commands
*/
void wee_display_commands (int weechat_cmd, int irc_cmd)
{
int i;
if (weechat_cmd)
{
printf (_("%s internal commands:\n"), PACKAGE_NAME);
printf ("\n");
for (i = 0; weechat_commands[i].command_name; i++)
{
printf ("* %s", weechat_commands[i].command_name);
if (weechat_commands[i].arguments &&
weechat_commands[i].arguments[0])
printf (" %s\n", _(weechat_commands[i].arguments));
else
printf ("\n");
if (weechat_commands[i].arguments_description &&
weechat_commands[i].arguments_description[0])
printf ("\n%s\n\n",
_(weechat_commands[i].arguments_description));
}
}
if (irc_cmd)
{
printf (_("IRC commands:\n"));
printf ("\n");
for (i = 0; irc_commands[i].command_name; i++)
{
if (irc_commands[i].cmd_function_args ||
irc_commands[i].cmd_function_1arg)
{
printf ("* %s", irc_commands[i].command_name);
if (irc_commands[i].arguments &&
irc_commands[i].arguments[0])
printf (" %s\n", _(irc_commands[i].arguments));
else
printf ("\n");
if (irc_commands[i].arguments_description &&
irc_commands[i].arguments_description[0])
printf ("\n%s\n\n",
_(irc_commands[i].arguments_description));
}
}
}
}
/*
* wee_parse_args: parse command line args
*/
@@ -274,6 +325,12 @@ wee_parse_args (int argc, char *argv[])
printf ("%s", WEE_USAGE2);
wee_shutdown (EXIT_SUCCESS);
}
if ((strcmp (argv[i], "-i") == 0)
|| (strcmp (argv[i], "--irc-commands") == 0))
{
wee_display_commands (0, 1);
wee_shutdown (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-l") == 0)
|| (strcmp (argv[i], "--license") == 0))
{
@@ -286,6 +343,12 @@ wee_parse_args (int argc, char *argv[])
printf (PACKAGE_VERSION "\n");
wee_shutdown (EXIT_SUCCESS);
}
if ((strcmp (argv[i], "-w") == 0)
|| (strcmp (argv[i], "--weechat-commands") == 0))
{
wee_display_commands (1, 0);
wee_shutdown (EXIT_SUCCESS);
}
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
{
if (server_init_with_url (argv[i], &server_tmp) < 0)
+6 -4
View File
@@ -81,10 +81,12 @@
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
#define WEE_USAGE2 \
" -c, --config config file help (list of options)\n" \
" -h, --help this help screen\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n\n"
" -c, --config display config file options\n" \
" -h, --help this help screen\n" \
" -i, --irc-commands display IRC commands\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n" \
" -w, --weechat-commands display WeeChat commands\n\n"
/* directory separator, depending on OS */