// vim:fileencoding=utf-8:foldmethod=marker

#ifndef COMMANDER_OUTPUT_H
#define COMMANDER_OUTPUT_H

#include "../../../common/aliases/aliases.h"
#include "../../../common/platform/platform.h"

#ifdef WAPP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP

typedef enum {
  SHELL_OUTPUT_DISCARD,
  SHELL_OUTPUT_PRINT,
  SHELL_OUTPUT_CAPTURE,
} CMDOutHandling;

typedef enum {
  SHELL_ERR_NO_ERROR,
  SHELL_ERR_INVALID_ARGS,
  SHELL_ERR_ALLOCATION_FAIL,
  SHELL_ERR_PROC_START_FAIL,
  SHELL_ERR_OUT_BUF_FULL,
  SHELL_ERR_PROC_EXIT_FAIL,
} CMDError;

typedef struct commander_result CMDResult;
struct commander_result {
  i32 exit_code;
  CMDError error;
  b8 exited;

#ifdef WAPP_PLATFORM_WINDOWS
  #include "../../../../common/misc/misc_utils.h"
  wapp_misc_utils_padding_size(sizeof(b8) + sizeof(i32) + sizeof(CMDError));
#endif // !WAPP_PLATFORM_WINDOWS
};

#ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP

#endif // !COMMANDER_OUTPUT_H
