Make version available through $kak_version and debug info

This commit is contained in:
Maxime Coste 2018-04-09 17:04:51 +10:00
parent fc86acd9f0
commit d571c207e6
4 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
src/kak
src/kak.debug
src/kak.opt
src/.version*
doc/kak.1
doc/kak.1.gz
doc/manpages/*.gz

View File

@ -102,6 +102,9 @@ informations about Kakoune's state:
*kak_config*::
directory containing the user configuration
*kak_version*::
version of the current Kakoune server (git hash or release name)
*kak_count*::
count parameter passed to the command

View File

@ -45,6 +45,8 @@
namespace Kakoune
{
extern const char* version;
namespace
{
@ -1146,6 +1148,7 @@ const CommandDesc debug_cmd = {
{
if (parser[0] == "info")
{
write_to_debug_buffer(format("version: {}", version));
write_to_debug_buffer(format("pid: {}", getpid()));
write_to_debug_buffer(format("session: {}", Server::instance().session()));
#ifdef KAK_DEBUG

View File

@ -37,6 +37,8 @@
namespace Kakoune
{
extern const char* version;
static const char* startup_info =
"Kakoune recent breaking changes:\n"
" * Highlighters have been refactored to be part of scopes\n"
@ -122,6 +124,10 @@ static const EnvVarDesc builtin_env_vars[] = { {
"config", false,
[](StringView name, const Context& context)
{ return config_directory(); }
}, {
"version", false,
[](StringView name, const Context& context) -> String
{ return version; }
}, {
"opt_", true,
[](StringView name, const Context& context)
@ -671,7 +677,7 @@ int run_server(StringView session, StringView server_init,
});
if (flags & ServerFlags::StartupInfo)
local_client->info_show("Welcome to Kakoune", startup_info, {}, InfoStyle::Prompt);
local_client->info_show(format("Kakoune {}", version), startup_info, {}, InfoStyle::Prompt);
}
while (not terminate and