mu: Make commands Result-based

Use Result<void> as the return value, simplifying some code.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-12 08:48:28 +03:00
parent 34c5ca1627
commit 158117e843
8 changed files with 252 additions and 401 deletions

View File

@ -60,44 +60,29 @@ Result<void> mu_cmd_fields(const MuConfig* opts);
* @param opts configuration options
* @param err receives error information, or NULL
*
* @return MU_OK (0) if the command succeeds,
* some error code otherwise
* @return Ok() or some error
*/
MuError mu_cmd_script(const MuConfig* opts, GError** err);
Result<void> mu_cmd_script(const MuConfig* opts);
/**
* execute the cfind command
*
* @param store store object to use
* @param opts configuration options
* @param err receives error information, or NULL
*
* @return MU_OK (0) if the command succeeds,
* some error code otherwise
* @return Ok() or some error
*/
MuError mu_cmd_cfind(const Mu::Store& store, const MuConfig* opts, GError** err);
/**
* execute some mu command, based on 'opts'
*
* @param opts configuration option
* @param err receives error information, or NULL
*
* @return MU_OK if all went wall, some error code otherwise
*/
MuError mu_cmd_execute(const MuConfig* opts, GError** err);
Result<void> mu_cmd_cfind(const Mu::Store& store, const MuConfig* opts);
/**
* execute the 'index' command
*
* @param store store object to use
* @param opts configuration options
* @param err receives error information, or NULL
*
* @return MU_OK (0) if the command succeeded,
* some error code otherwise
* @return Ok() or some error
*/
MuError mu_cmd_index(Mu::Store& store, const MuConfig* opt, GError** err);
Result<void> mu_cmd_index(Mu::Store& store, const MuConfig* opt);
/**
* execute the server command
@ -106,7 +91,17 @@ MuError mu_cmd_index(Mu::Store& store, const MuConfig* opt, GError** err);
*
* @return MU_OK (0) if the command succeeds, some error code otherwise
*/
MuError mu_cmd_server(const MuConfig* opts, GError** err);
Result<void> mu_cmd_server(const MuConfig* opts);
/**
* execute some mu command, based on 'opts'
*
* @param opts configuration option
* @param err receives error information, or NULL
*
* @return Ok() or some error
*/
Result<void> mu_cmd_execute(const MuConfig* opts);
} // namespace Mu