Created
August 13, 2026 02:27
-
-
Save zenspider/29642547ec147eafec2c3fc4db7c3982 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| modified ruby.c | |
| @@ -1708,9 +1708,12 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) | |
| case 'E': | |
| if (!*++s && (!--argc || !(s = *++argv))) { | |
| - rb_raise(rb_eRuntimeError, "missing argument for -E"); | |
| - } | |
| - proc_encoding_option(opt, s, "-E"); | |
| + printf("Available Encodings:\n\n"); | |
| + // cheat! I can't call rb_eval_string at this point of init | |
| + opt->e_script = rb_str_new2("puts Encoding.constants.map { |k| Encoding.const_get(k) }.grep(Encoding).map(&:name).uniq.grep_v(/stateless|-SoftBank/).sort_by(&:downcase).join(', '); exit(1)"); | |
| + opt->script = "-e"; | |
| + } else | |
| + proc_encoding_option(opt, s, "-E"); | |
| break; | |
| case 'U': |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment