GitHub

File tree

  • mrbgems/mruby-bin-mirb/tools/mirb

Original file line numberDiff line numberDiff line change

@@ -29,6 +29,8 @@

2929

#include <signal.h>

3030

#include <setjmp.h>

3131
32+

#include "mirb_completion.h"

33+
3234

/* obsolete configuration */

3335

#ifdef ENABLE_READLINE

3436

# define MRB_USE_READLINE

@@ -594,6 +596,15 @@ main(int argc, char **argv)

594596

mrb_ccontext_filename(mrb, cxt, "(mirb)");

595597

if (args.verbose) cxt->dump_result = TRUE;

596598
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+
597608

ai = mrb_gc_arena_save(mrb);

598609
599610

while (TRUE) {

@@ -807,6 +818,16 @@ main(int argc, char **argv)

807818

mrb_free(mrb, args.libv);

808819

}

809820

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+
810831

mrb_close(mrb);

811832
812833

return 0;

Read the original on github.com ↗