summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-09 07:57:31 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-09 07:57:31 +0000
commit40f304e025dbaeb954e2c324836ab4cf23f12053 (patch)
tree027859c0cf4423991ea9aa7cbb89f6a78f39faee /ruby.c
parentabd5b8e1db39b9d3714fb491013ff8a156dcdf27 (diff)
* ruby.c (usage, enable_option, disable_option, process_options): new
option `--disable_did_you_mean`. * gem_prelude.rb: now requires did_you_mean gem by default if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index a6f5ca1..389aac5 100644
--- a/ruby.c
+++ b/ruby.c
@@ -62,6 +62,7 @@ char *getenv();
#define DISABLE_BIT(bit) (1U << disable_##bit)
enum disable_flag_bits {
disable_gems,
+ disable_did_you_mean,
disable_rubyopt,
disable_flag_count
};
@@ -192,6 +193,7 @@ usage(const char *name, int help)
};
static const struct message features[] = {
M("gems", "", "rubygems (default: "DEFAULT_RUBYGEMS_ENABLED")"),
+ M("did_you_mean", "", "did_you_mean (default: "DEFAULT_RUBYGEMS_ENABLED")"),
M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"),
};
int i;
@@ -710,6 +712,7 @@ enable_option(const char *str, int len, void *arg)
{
#define UNSET_WHEN_DISABLE(bit) UNSET_WHEN(#bit, DISABLE_BIT(bit), str, len)
UNSET_WHEN_DISABLE(gems);
+ UNSET_WHEN_DISABLE(did_you_mean);
UNSET_WHEN_DISABLE(rubyopt);
if (NAME_MATCH_P("all", str, len)) {
*(unsigned int *)arg = 0U;
@@ -723,6 +726,7 @@ disable_option(const char *str, int len, void *arg)
{
#define SET_WHEN_DISABLE(bit) SET_WHEN(#bit, DISABLE_BIT(bit), str, len)
SET_WHEN_DISABLE(gems);
+ SET_WHEN_DISABLE(did_you_mean);
SET_WHEN_DISABLE(rubyopt);
if (NAME_MATCH_P("all", str, len)) {
*(unsigned int *)arg = ~0U;
@@ -1435,6 +1439,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
if (!(opt->disable & DISABLE_BIT(gems))) {
rb_define_module("Gem");
}
+ if (!(opt->disable & DISABLE_BIT(did_you_mean))) {
+ rb_define_module("DidYouMean");
+ }
ruby_init_prelude();
#if UTF8_PATH
opt->script_name = str_conv_enc(opt->script_name, rb_utf8_encoding(), lenc);