<commit_before>#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <fcntl.h>
#include <unistd.h> 
#include "microrl.h"

#define DBG(...) printf("\033[33m");printf(__VA_ARGS__);printf("\033[0m");

#define _NUM_OF_CMD 5
char * keyworld [] = {"fuck","help","list","function", "lisp"};
char ** compl_world [_NUM_OF_CMD + 1];

//*****************************************************************************
// print callback for microrl library
void print (char * str)
{
	fprintf (stdout, "%s", str);
}

//*****************************************************************************
void print_help ()
{
	print ("Use TAB key for completion\nCommand:\n\thelp - this message\n\tlist - list all commands in tree\n");
}

//*****************************************************************************
// execute callback for microrl library
int execute (int argc, const char * const * tkn_arr)
{
	int i = 0;
	while (i < argc) {
		if (strcmp (tkn_arr[i], "help") == 0) {
			print ("microrl library based shell v 1.0\n");
			print_help ();
			return 1;
		} else {
			print ("command: '");
			print (tkn_arr[i]);
			print ("' Not found.\n");
		}
		i++;
	}
	return 0;
}

//*****************************************************************************
// completion callback for microrl library
char ** complet (int argc, const char * const * argv)
{
	int j = 0;

//	for (int i = 0; i < argc; i++) {
//		DBG ("[%s]\n", argv[i]);
//	}
	compl_world [0] = NULL;

	// if there is tocken in cmdline
	if (argc > 0) {
		// get last entered tocken
		char * bit = argv [argc-1];
		// iterate through our available token and match it<commit_msg>add execute list command example<commit_after>#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <fcntl.h>
#include <unistd.h> 
#include "microrl.h"

#define DBG(...) printf("\033[33m");printf(__VA_ARGS__);printf("\033[0m");

#define _NUM_OF_CMD 5
char * keyworld [] = {"fuck","help","list","function", "lisp"};
char ** compl_world [_NUM_OF_CMD + 1];

//*****************************************************************************
// print callback for microrl library
void print (char * str)
{
	fprintf (stdout, "%s", str);
}

//*****************************************************************************
void print_help ()
{
	print ("Use TAB key for completion\nCommand:\n\thelp - this message\n\tlist - list all commands in tree\n");
}

//*****************************************************************************
// execute callback for microrl library
int execute (int argc, const char * const * tkn_arr)
{
	int i = 0;
	while (i < argc) {
		if (strcmp (tkn_arr[i], "help") == 0) {
			print ("microrl library based shell v 1.0\n");
			print_help ();
			return 1;
		} else if (strcmp (tkn_arr[i], "list") == 0) {
			print ("available command:\n");
			for (int i = 0; i < _NUM_OF_CMD; i++) {
				print ("\t");
				print (keyworld[i]);
				print ("\n");
			}
			return 1;
		} else {
			print ("command: '");
			print (tkn_arr[i]);
			print ("' Not found.\n");
		}
		i++;
	}
	return 0;
}

//*****************************************************************************
// completion callback for microrl library
char ** complet (int argc, const char * const * argv)
{
	int j = 0;

//	for (int i = 0; i < argc; i++) {
//		DBG ("[%s]\n", argv[i]);
//	}
	compl_world [0] = NULL;

	// if there is tocken in cmdline
	if (argc > 0) {
		// get last entered tocken
		char * bit = argv [argc-1];
		// iterate through our available token and match it
{'fraction_non_alphanumeric': 0.32797971259509723, 'fraction_numerical': 0.013243167089320936, 'mean_word_length': 4.107913669064748, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6834930', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1142, 'n_words': 337}