248 |
} |
} |
249 |
|
|
250 |
/* |
/* |
251 |
|
* wee_display_commands: display WeeChat and/or IRC commands |
252 |
|
*/ |
253 |
|
|
254 |
|
void wee_display_commands (int weechat_cmd, int irc_cmd) |
255 |
|
{ |
256 |
|
int i; |
257 |
|
|
258 |
|
if (weechat_cmd) |
259 |
|
{ |
260 |
|
printf (_("%s internal commands:\n"), PACKAGE_NAME); |
261 |
|
printf ("\n"); |
262 |
|
for (i = 0; weechat_commands[i].command_name; i++) |
263 |
|
{ |
264 |
|
printf ("* %s", weechat_commands[i].command_name); |
265 |
|
if (weechat_commands[i].arguments && |
266 |
|
weechat_commands[i].arguments[0]) |
267 |
|
printf (" %s\n", _(weechat_commands[i].arguments)); |
268 |
|
else |
269 |
|
printf ("\n"); |
270 |
|
if (weechat_commands[i].arguments_description && |
271 |
|
weechat_commands[i].arguments_description[0]) |
272 |
|
printf ("\n%s\n\n", |
273 |
|
_(weechat_commands[i].arguments_description)); |
274 |
|
} |
275 |
|
} |
276 |
|
|
277 |
|
if (irc_cmd) |
278 |
|
{ |
279 |
|
printf (_("IRC commands:\n")); |
280 |
|
printf ("\n"); |
281 |
|
for (i = 0; irc_commands[i].command_name; i++) |
282 |
|
{ |
283 |
|
if (irc_commands[i].cmd_function_args || |
284 |
|
irc_commands[i].cmd_function_1arg) |
285 |
|
{ |
286 |
|
printf ("* %s", irc_commands[i].command_name); |
287 |
|
if (irc_commands[i].arguments && |
288 |
|
irc_commands[i].arguments[0]) |
289 |
|
printf (" %s\n", _(irc_commands[i].arguments)); |
290 |
|
else |
291 |
|
printf ("\n"); |
292 |
|
if (irc_commands[i].arguments_description && |
293 |
|
irc_commands[i].arguments_description[0]) |
294 |
|
printf ("\n%s\n\n", |
295 |
|
_(irc_commands[i].arguments_description)); |
296 |
|
} |
297 |
|
} |
298 |
|
} |
299 |
|
} |
300 |
|
|
301 |
|
/* |
302 |
* wee_parse_args: parse command line args |
* wee_parse_args: parse command line args |
303 |
*/ |
*/ |
304 |
|
|
325 |
printf ("%s", WEE_USAGE2); |
printf ("%s", WEE_USAGE2); |
326 |
wee_shutdown (EXIT_SUCCESS); |
wee_shutdown (EXIT_SUCCESS); |
327 |
} |
} |
328 |
|
if ((strcmp (argv[i], "-i") == 0) |
329 |
|
|| (strcmp (argv[i], "--irc-commands") == 0)) |
330 |
|
{ |
331 |
|
wee_display_commands (0, 1); |
332 |
|
wee_shutdown (EXIT_SUCCESS); |
333 |
|
} |
334 |
else if ((strcmp (argv[i], "-l") == 0) |
else if ((strcmp (argv[i], "-l") == 0) |
335 |
|| (strcmp (argv[i], "--license") == 0)) |
|| (strcmp (argv[i], "--license") == 0)) |
336 |
{ |
{ |
343 |
printf (PACKAGE_VERSION "\n"); |
printf (PACKAGE_VERSION "\n"); |
344 |
wee_shutdown (EXIT_SUCCESS); |
wee_shutdown (EXIT_SUCCESS); |
345 |
} |
} |
346 |
|
if ((strcmp (argv[i], "-w") == 0) |
347 |
|
|| (strcmp (argv[i], "--weechat-commands") == 0)) |
348 |
|
{ |
349 |
|
wee_display_commands (1, 0); |
350 |
|
wee_shutdown (EXIT_SUCCESS); |
351 |
|
} |
352 |
else if ((strncasecmp (argv[i], "irc://", 6) == 0)) |
else if ((strncasecmp (argv[i], "irc://", 6) == 0)) |
353 |
{ |
{ |
354 |
if (server_init_with_url (argv[i], &server_tmp) < 0) |
if (server_init_with_url (argv[i], &server_tmp) < 0) |