Invoke corresponding functions based on cmd
's type and value.
- Returns
- Result of the operation
Definition at line 22 of file invoke.c.
22 {
63 format_success(
"%s",
"Unknown command. Use \"help\" for more information\n");
68 format_success(
"%s",
"Invalid syntax. Use \"help\" for more information\n");
74 default:
75 assert(false && "unimplemented command");
77 }
78}
enum run_result run_add_path(const os_char *new_path)
enum run_result run_cd(os_char *new_dir)
Change current working directory.
enum run_result run_child_processes(int proc_id)
Resume running a process.
enum run_result run_get_date()
get date
enum run_result run_get_time()
get time
enum run_result run_del(const os_char *filename)
Delete a specific file.
enum run_result run_unset_env(const os_char *name)
Unset current process's environment variable.
enum run_result run_get_all_env()
Set current process's environment variable.
enum run_result run_get_env(const os_char *name)
Set current process's environment variable.
enum run_result run_set_env(const os_char *name, const os_char *val)
Set current process's environment variable.
enum run_result run_help()
Display help message.
void format_success(char *fmt,...)
Used format_xxx instead of printf and such for uniform output.
enum run_result run_kill(int proc_id)
Kill a process.
enum run_result run_launch_executable(const struct args args)
Run the executable foreground.
enum run_result run_get_list_process()
get list all running processes
enum run_result run_lsdir(const os_char *dir)
List files/folders in a directory.
enum run_result run_minibat(const struct args args)
Run the executable foreground.
void clear_screen()
Clear the console.
enum run_result run_resume(int proc_id)
Resume running a process.
enum run_result run_stop(int proc_id)
Resume running a process.
Resulting struct after parsing the input.
References clear_screen(), CMD_ADD_PATH, CMD_CHANGE_DIR, CMD_CHILD_PROCESSES, CMD_CLEAR, CMD_DATE, CMD_DEL_FILE, CMD_EXIT, CMD_GET_ENV, CMD_GET_ENV_ALL, CMD_HELP, CMD_INVALID_SYNTAX, CMD_KILL, CMD_LAUNCH_EXECUTABLE, CMD_LIST, CMD_LSDIR, CMD_MINIBAT, CMD_NOOP, CMD_RESUME, CMD_SET_ENV, CMD_STOP_PROC, CMD_TIME, CMD_UNKNOWN, CMD_UNSET_ENV, format_success(), run_add_path(), run_cd(), run_child_processes(), run_del(), RUN_EXIT, RUN_FAILED, run_get_all_env(), run_get_date(), run_get_env(), run_get_list_process(), run_get_time(), run_help(), run_kill(), run_launch_executable(), run_lsdir(), run_minibat(), RUN_OK, run_resume(), run_set_env(), run_stop(), run_unset_env(), cmd::type, and cmd::val.
Referenced by main().