@@ -29,6 +29,8 @@
|
29 | 29 | #include <signal.h> |
30 | 30 | #include <setjmp.h> |
31 | 31 | |
| 32 | +#include "mirb_completion.h" |
| 33 | + |
32 | 34 | /* obsolete configuration */ |
33 | 35 | #ifdef ENABLE_READLINE |
34 | 36 | # define MRB_USE_READLINE |
@@ -594,6 +596,15 @@ main(int argc, char **argv)
|
594 | 596 | mrb_ccontext_filename(mrb, cxt, "(mirb)"); |
595 | 597 | if (args.verbose) cxt->dump_result = TRUE; |
596 | 598 | |
| 599 | +/* Setup tab completion */ |
| 600 | +#ifdef MRB_USE_READLINE |
| 601 | +#ifndef MRB_USE_LINENOISE |
| 602 | +mirb_setup_readline_completion(mrb, cxt); |
| 603 | +#else |
| 604 | +mirb_setup_linenoise_completion(mrb, cxt); |
| 605 | +#endif |
| 606 | +#endif |
| 607 | + |
597 | 608 | ai = mrb_gc_arena_save(mrb); |
598 | 609 | |
599 | 610 | while (TRUE) { |
@@ -807,6 +818,16 @@ main(int argc, char **argv)
|
807 | 818 | mrb_free(mrb, args.libv); |
808 | 819 | } |
809 | 820 | mrb_ccontext_free(mrb, cxt); |
| 821 | + |
| 822 | +/* Cleanup tab completion */ |
| 823 | +#ifdef MRB_USE_READLINE |
| 824 | +#ifndef MRB_USE_LINENOISE |
| 825 | +mirb_cleanup_readline_completion(); |
| 826 | +#else |
| 827 | +mirb_cleanup_linenoise_completion(); |
| 828 | +#endif |
| 829 | +#endif |
| 830 | + |
810 | 831 | mrb_close(mrb); |
811 | 832 | |
812 | 833 | return 0; |
|