summaryrefslogtreecommitdiff
path: root/src/core/wee-command.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-12-16 23:07:33 +0100
committerSebastien Helleu <flashcode@flashtux.org>2012-12-16 23:07:33 +0100
commit2b78673aa9717871e993212949287fdd8d0bb033 (patch)
treecf5ffdc86b646620c2095d6f6f525beda7eb3a25 /src/core/wee-command.c
parentfc0b73207b51eed495e35ac5f341c8b4d1ee4f40 (diff)
downloadweechat-2b78673aa9717871e993212949287fdd8d0bb033.zip
core: add git version in build, display it in "weechat-curses --help" and /version
Diffstat (limited to 'src/core/wee-command.c')
-rw-r--r--src/core/wee-command.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 10ef4d126..601192561 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -49,6 +49,7 @@
#include "wee-upgrade.h"
#include "wee-utf8.h"
#include "wee-util.h"
+#include "wee-version.h"
#include "../gui/gui-bar.h"
#include "../gui/gui-bar-item.h"
#include "../gui/gui-buffer.h"
@@ -4999,20 +5000,28 @@ COMMAND_CALLBACK(uptime)
void
command_version_display (struct t_gui_buffer *buffer,
int send_to_buffer_as_input,
- int translated_string)
+ int translated_string,
+ int display_git_version)
{
char string[512];
+ const char *git_version;
+
+ /* get git version */
+ git_version = (display_git_version) ? version_get_git () : NULL;
if (send_to_buffer_as_input)
{
if (translated_string)
{
snprintf (string, sizeof (string),
- "WeeChat %s [%s %s %s]",
- PACKAGE_VERSION,
+ "WeeChat %s%s%s%s [%s %s %s]",
+ version_get_version (),
+ (git_version && git_version[0]) ? " (git: " : "",
+ (git_version && git_version[0]) ? git_version : "",
+ (git_version && git_version[0]) ? ")" : "",
_("compiled on"),
- __DATE__,
- __TIME__);
+ version_get_compilation_date (),
+ version_get_compilation_time ());
input_data (buffer, string);
if (weechat_upgrade_count > 0)
{
@@ -5028,11 +5037,14 @@ command_version_display (struct t_gui_buffer *buffer,
else
{
snprintf (string, sizeof (string),
- "WeeChat %s [%s %s %s]",
- PACKAGE_VERSION,
+ "WeeChat %s%s%s%s [%s %s %s]",
+ version_get_version (),
+ (git_version && git_version[0]) ? " (git: " : "",
+ (git_version && git_version[0]) ? git_version : "",
+ (git_version && git_version[0]) ? ")" : "",
"compiled on",
- __DATE__,
- __TIME__);
+ version_get_compilation_date (),
+ version_get_compilation_time ());
input_data (buffer, string);
if (weechat_upgrade_count > 0)
{
@@ -5048,14 +5060,17 @@ command_version_display (struct t_gui_buffer *buffer,
}
else
{
- gui_chat_printf (NULL, "%sWeeChat %s %s[%s%s %s %s%s]",
+ gui_chat_printf (NULL, "%sWeeChat %s%s%s%s %s[%s%s %s %s%s]",
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
- PACKAGE_VERSION,
+ version_get_version (),
+ (git_version && git_version[0]) ? " (git: " : "",
+ (git_version && git_version[0]) ? git_version : "",
+ (git_version && git_version[0]) ? ")" : "",
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_VALUE),
_("compiled on"),
- __DATE__,
- __TIME__,
+ version_get_compilation_date (),
+ version_get_compilation_time (),
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
if (weechat_upgrade_count > 0)
{
@@ -5096,7 +5111,7 @@ COMMAND_CALLBACK(version)
}
command_version_display (buffer, send_to_buffer_as_input,
- translated_string);
+ translated_string, 1);
return WEECHAT_RC_OK;
}