From ca70c9061146386ce0986631cd7fc9209a935a34 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 31 Jul 2025 17:19:07 +0300 Subject: added -v/--version and command * DEC TECO had an command. In contrast to DEC TECO's implementation, the value reported by encodes a major.minor.micro semantic version. --- src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index a04d1d1..42e1520 100644 --- a/src/main.c +++ b/src/main.c @@ -108,6 +108,7 @@ teco_get_default_config_path(void) #endif +static gboolean teco_show_version = FALSE; static gchar *teco_eval_macro = NULL; static gboolean teco_mung_file = FALSE; static gboolean teco_mung_profile = TRUE; @@ -119,6 +120,8 @@ static gchar * teco_process_options(gchar ***argv) { static const GOptionEntry option_entries[] = { + {"version", 'v', 0, G_OPTION_ARG_NONE, &teco_show_version, + "Show version"}, {"eval", 'e', 0, G_OPTION_ARG_STRING, &teco_eval_macro, "Evaluate macro", "macro"}, {"mung", 'm', 0, G_OPTION_ARG_NONE, &teco_mung_file, @@ -187,6 +190,11 @@ teco_process_options(gchar ***argv) exit(EXIT_FAILURE); } + if (teco_show_version) { + puts(PACKAGE_VERSION); + exit(EXIT_SUCCESS); + } + if ((*argv)[0] && !g_strcmp0((*argv)[1], "-S")) { /* translate -S to --, this is always passed down */ (*argv)[1][1] = '-'; -- cgit v1.2.3