diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/common/weechat.c | 63 | ||||
-rw-r--r-- | src/common/weechat.h | 10 | ||||
-rw-r--r-- | weechat/ChangeLog | 3 | ||||
-rw-r--r-- | weechat/src/common/weechat.c | 63 | ||||
-rw-r--r-- | weechat/src/common/weechat.h | 10 |
6 files changed, 142 insertions, 10 deletions
@@ -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) diff --git a/src/common/weechat.c b/src/common/weechat.c index 924a68669..74d2c47cd 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -248,6 +248,57 @@ void wee_display_config_options () } /* + * 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) diff --git a/src/common/weechat.h b/src/common/weechat.h index 6e60acedd..24520765e 100644 --- a/src/common/weechat.h +++ b/src/common/weechat.h @@ -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 */ diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 2c21d21cf..cb0271950 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -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) diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index 924a68669..74d2c47cd 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -248,6 +248,57 @@ void wee_display_config_options () } /* + * 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) diff --git a/weechat/src/common/weechat.h b/weechat/src/common/weechat.h index 6e60acedd..24520765e 100644 --- a/weechat/src/common/weechat.h +++ b/weechat/src/common/weechat.h @@ -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 */ |