Commit 01ee79ee authored by Sebastian Ramacher's avatar Sebastian Ramacher
Browse files

Merge branch 'sourcecmd' into 'develop'

Add source command

See merge request !47
parents c6ec5044 09caffe2
Pipeline #407 failed with stages
......@@ -19,6 +19,7 @@
#include "internal.h"
#include "render.h"
#include "adjustment.h"
#include "config.h"
#include <girara/session.h>
#include <girara/settings.h>
......@@ -605,3 +606,24 @@ cmd_version(girara_session_t* session, girara_list_t* UNUSED(argument_list))
return true;
}
bool
cmd_source(girara_session_t* session, girara_list_t* argument_list)
{
g_return_val_if_fail(session != NULL, false);
g_return_val_if_fail(session->global.data != NULL, false);
zathura_t* zathura = session->global.data;
const int argc = girara_list_size(argument_list);
if (argc > 1) {
girara_notify(session, GIRARA_ERROR, _("Too many arguments."));
return false;
} else if (argc == 1) {
zathura_set_config_dir(zathura, girara_list_nth(argument_list, 0));
config_load_files(zathura);
} else {
config_load_files(zathura);
}
return true;
}
......@@ -169,4 +169,13 @@ bool cmd_offset(girara_session_t* session, girara_list_t* argument_list);
*/
bool cmd_version(girara_session_t* session, girara_list_t* argument_list);
/**
* Source config file
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return true if no error occurred
*/
bool cmd_source(girara_session_t* session, girara_list_t* argument_list);
#endif // COMMANDS_H
......@@ -510,6 +510,7 @@ config_load_default(zathura_t* zathura)
girara_inputbar_command_add(gsession, "nohlsearch", "nohl", cmd_nohlsearch, NULL, _("Don't highlight current search results"));
girara_inputbar_command_add(gsession, "hlsearch", NULL, cmd_hlsearch, NULL, _("Highlight current search results"));
girara_inputbar_command_add(gsession, "version", NULL, cmd_version, NULL, _("Show version information"));
girara_inputbar_command_add(gsession, "source", NULL, cmd_source, NULL, _("Source config file"));
girara_special_command_add(gsession, '/', cmd_search, INCREMENTAL_SEARCH, FORWARD, NULL);
girara_special_command_add(gsession, '?', cmd_search, INCREMENTAL_SEARCH, BACKWARD, NULL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment