package embox.cmd.sh

module shell_registry {
	option number input_buff_sz = 128
	source "shell.c"

	@IncludeExport(path="cmd")
	source "shell.h"

	@NoRuntime depends embox.lib.libds
}

abstract module shell_api {
	option string prompt = "embox> "
	option string welcome_msg = "Welcome to Embox and have a lot of fun!"
}

@AutoCmd
@Cmd(name = "tish",
	help = "Start tish - tiny shell interpretator",
	man = '''
		NAME
			tish - tiny shell
		AUTHORS
			Anton Kozlov
	''')
module tish extends shell_api {
	option number rich_prompt_support = 0
	option number unset_nodelay_mode = 0

	option string builtin_commands = "cd export exit logout"

	source "tish.c"

	depends embox.compat.posix.util.environ
	depends embox.lib.Tokenizer
	depends embox.lib.readline_api
	depends embox.mem.heap_api

	depends embox.framework.LibFramework
	depends embox.cmd.sh.shell_registry
	depends embox.kernel.task.api
	depends embox.compat.posix.proc.pid
	depends embox.compat.posix.proc.uid
	depends embox.compat.posix.proc.waitpid
	depends embox.compat.posix.pwd_api
	depends embox.compat.libc.str_dup

	@NoRuntime depends embox.compat.posix.util.sleep
	depends embox.cmd.exit
	depends embox.cmd.logout
}

@AutoCmd
@Cmd(name = "shell_run",
	help = "Run shell by name",
	man = '''
		NAME
			shell_run <shell>
		EXAMPLES
			Run tish:
			shell_run tish
		AUTHORS
			Alexander Kamuk
	''')
module shell_run {
	source "shell_run.c"

	depends embox.compat.libc.all
	depends embox.framework.LibFramework
}

@AutoCmd
@Cmd(name = "exec_helper",
	help = "",
	man = "")
module exec_helper {
	source "exec_helper.c"
}
