/[weechat]/weechat/src/common/command.c
ViewVC logotype

Diff of /weechat/src/common/command.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.69 by flashcode, Wed Sep 28 12:58:41 2005 UTC revision 1.70 by flashcode, Sun Oct 2 08:16:12 2005 UTC
# Line 126  t_weechat_command weechat_commands[] = Line 126  t_weechat_command weechat_commands[] =
126      N_("[file]"), N_("file: filename for writing config"),      N_("[file]"), N_("file: filename for writing config"),
127      0, 1, weechat_cmd_save, NULL },      0, 1, weechat_cmd_save, NULL },
128    { "set", N_("set config parameters"),    { "set", N_("set config parameters"),
129      N_("[option[=value]]"), N_("option: name of an option\nvalue: value for option"),      N_("[option [ = value]]"),
130        N_("option: name of an option (if name is full "
131           "and no value is given, then help is displayed on option)\n"
132           "value: value for option"),
133      0, MAX_ARGS, NULL, weechat_cmd_set },      0, MAX_ARGS, NULL, weechat_cmd_set },
134    { "unalias", N_("remove an alias"),    { "unalias", N_("remove an alias"),
135      N_("alias_name"), N_("alias_name: name of alias to remove"),      N_("alias_name"), N_("alias_name: name of alias to remove"),
# Line 2393  weechat_cmd_set (char *arguments) Line 2396  weechat_cmd_set (char *arguments)
2396      t_irc_server *ptr_server;      t_irc_server *ptr_server;
2397      char option_name[256];      char option_name[256];
2398      void *ptr_option_value;      void *ptr_option_value;
2399      int number_found;      int last_section, last_option, number_found;
2400    
2401      option = NULL;      option = NULL;
2402      value = NULL;      value = NULL;
# Line 2518  weechat_cmd_set (char *arguments) Line 2521  weechat_cmd_set (char *arguments)
2521      }      }
2522      else      else
2523      {      {
2524            last_section = -1;
2525            last_option = -1;
2526          number_found = 0;          number_found = 0;
2527          for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)          for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
2528          {          {
# Line 2542  weechat_cmd_set (char *arguments) Line 2547  weechat_cmd_set (char *arguments)
2547                              section_displayed = 1;                              section_displayed = 1;
2548                          }                          }
2549                          weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL);                          weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL);
2550                            last_section = i;
2551                            last_option = j;
2552                          number_found++;                          number_found++;
2553                      }                      }
2554                  }                  }
# Line 2577  weechat_cmd_set (char *arguments) Line 2584  weechat_cmd_set (char *arguments)
2584                          weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],                          weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
2585                                                          ptr_server->name,                                                          ptr_server->name,
2586                                                          ptr_option_value);                                                          ptr_option_value);
2587                            last_section = CONFIG_SECTION_SERVER;
2588                            last_option = i;
2589                          number_found++;                          number_found++;
2590                      }                      }
2591                  }                  }
# Line 2592  weechat_cmd_set (char *arguments) Line 2601  weechat_cmd_set (char *arguments)
2601          }          }
2602          else          else
2603          {          {
2604              gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);              if ((number_found == 1) && (last_section >= 0) && (last_option >= 0))
2605              if (option)              {
2606                  gui_printf (NULL, _("config option(s) found with \"%s\"\n"),                  gui_printf (NULL, "\n");
2607                              option);                  gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, _("Detail:\n"));
2608                    switch (weechat_options[last_section][last_option].option_type)
2609                    {
2610                        case OPTION_TYPE_BOOLEAN:
2611                            gui_printf (NULL, _("  . type boolean (values: 'on' or 'off')\n"));
2612                            gui_printf (NULL, _("  . default value: '%s'\n"),
2613                                        (weechat_options[last_section][last_option].default_int == BOOL_TRUE) ?
2614                                        "on" : "off");
2615                            break;
2616                        case OPTION_TYPE_INT:
2617                            gui_printf (NULL, _("  . type integer (values: between %d and %d)\n"),
2618                                        weechat_options[last_section][last_option].min,
2619                                        weechat_options[last_section][last_option].max);
2620                            gui_printf (NULL, _("  . default value: %d\n"),
2621                                        weechat_options[last_section][last_option].default_int);
2622                            break;
2623                        case OPTION_TYPE_INT_WITH_STRING:
2624                            gui_printf (NULL, _("  . type string (values: "));
2625                            i = 0;
2626                            while (weechat_options[last_section][last_option].array_values[i])
2627                            {
2628                                gui_printf (NULL, "'%s'",
2629                                            weechat_options[last_section][last_option].array_values[i]);
2630                                if (weechat_options[last_section][last_option].array_values[i + 1])
2631                                    gui_printf (NULL, ", ");
2632                                i++;
2633                            }
2634                            gui_printf (NULL, ")\n");
2635                            gui_printf (NULL, _("  . default value: '%s'\n"),
2636                                (weechat_options[last_section][last_option].default_string) ?
2637                                weechat_options[last_section][last_option].default_string : _("empty"));
2638                            break;
2639                        case OPTION_TYPE_COLOR:
2640                            gui_printf (NULL, _("  . type color (Curses or Gtk color, look at WeeChat doc)\n"));
2641                            gui_printf (NULL, _("  . default value: '%s'\n"),
2642                                (weechat_options[last_section][last_option].default_string) ?
2643                                weechat_options[last_section][last_option].default_string : _("empty"));
2644                            break;
2645                        case OPTION_TYPE_STRING:
2646                            gui_printf (NULL, _("  . type string (any string)\n"));
2647                            gui_printf (NULL, _("  . default value: '%s'\n"),
2648                                        (weechat_options[last_section][last_option].default_string) ?
2649                                        weechat_options[last_section][last_option].default_string : _("empty"));
2650                            break;
2651                    }
2652                    gui_printf (NULL, _("  . description: %s\n"),
2653                                _(weechat_options[last_section][last_option].long_description));
2654                }
2655              else              else
2656                  gui_printf (NULL, _("config option(s) found\n"));              {
2657                    gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);
2658                    if (option)
2659                        gui_printf (NULL, _("config option(s) found with \"%s\"\n"),
2660                                    option);
2661                    else
2662                        gui_printf (NULL, _("config option(s) found\n"));
2663                }
2664          }          }
2665      }      }
2666      return 0;      return 0;

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26