* mu-config: move command handling to mu-cmd

This commit is contained in:
Dirk-Jan C. Binnema
2011-08-30 21:58:35 +03:00
parent 0861319091
commit c7d7965f0d
2 changed files with 43 additions and 103 deletions

View File

@ -38,7 +38,7 @@ enum _MuConfigFormat {
/* for cfind, find, view */
MU_CONFIG_FORMAT_PLAIN, /* plain output */
/* for cfind */
MU_CONFIG_FORMAT_MUTT_ALIAS, /* mutt alias style */
MU_CONFIG_FORMAT_MUTT_AB, /* mutt ext abook */
@ -60,7 +60,7 @@ typedef enum _MuConfigFormat MuConfigFormat;
enum _MuConfigCmd {
MU_CONFIG_CMD_UNKNOWN = 0,
MU_CONFIG_CMD_INDEX,
MU_CONFIG_CMD_FIND,
MU_CONFIG_CMD_CLEANUP,
@ -87,7 +87,7 @@ struct _MuConfig {
* MU_CONFIG_CMD_NONE */
const char *cmdstr; /* cmd string, for user
* info */
/* general options */
gboolean quiet; /* don't give any output */
gboolean debug; /* spew out debug info */
@ -96,7 +96,7 @@ struct _MuConfig {
gboolean log_stderr; /* log to stderr (not logfile) */
gchar** params; /* parameters (for querying) */
gboolean color; /* use ansi-colors in some output */
/* options for indexing */
char *maildir; /* where the mails are */
gboolean nocleanup; /* don't cleanup del'd mails from db */
@ -108,9 +108,9 @@ struct _MuConfig {
* commits, or 0 for
* default */
int max_msg_size; /* maximum size for message files */
/* options for querying 'find' (and view-> 'summary') */
char *fields; /* fields to show in output */
char *fields; /* fields to show in output */
char *sortfield; /* field to sort by (string) */
gboolean descending; /* sort descending (z->a)? */
gboolean threads; /* show message threads */
@ -138,7 +138,7 @@ struct _MuConfig {
gboolean terminator; /* add separator \f between
* multiple messages in mu
* view */
/* output to a maildir with symlinks */
char *linksdir; /* maildir to output symlinks */
gboolean clearlinks; /* clear a linksdir before filling */
@ -152,34 +152,34 @@ struct _MuConfig {
char *targetdir; /* where to save the attachments */
gboolean overwrite; /* should we overwrite same-named files */
gboolean play; /* after saving, try to 'play'
* (open) the attmnt using xdgopen */
* (open) the attmnt using xdgopen */
};
typedef struct _MuConfig MuConfig;
/**
* create a new mu config object
*
*
* set default values for the configuration options; when you call
* mu_config_init, you should also call mu_config_uninit when the data
* is no longer needed.
*
* @param opts options
*
* @param opts options
*/
MuConfig *mu_config_new (int *argcp, char ***argvp)
G_GNUC_WARN_UNUSED_RESULT;
/**
* free the MuOptionsConfig structure; the the muhome and maildir
* members are heap-allocated, so must be freed.
*
*
* @param opts a MuConfig struct, or NULL
*/
void mu_config_destroy (MuConfig *opts);
/**
* execute the command / options in this config
*
*
* @param opts the commands/options
*
*
* @return a value denoting the success/failure of the execution;
* MU_ERROR_NONE (0) for success, non-zero for a failure. This is to used for
* the exit code of the process
@ -189,9 +189,9 @@ MuError mu_config_execute (MuConfig *opts);
/**
* count the number of non-option parameters
*
*
* @param conf a MuConfig instance
*
*
* @return the number of non-option parameters, or 0 in case of error
*/
guint mu_config_param_num (MuConfig *conf);