From ebb194eda673c97501edeefd5849c9a70291d061 Mon Sep 17 00:00:00 2001 From: phkahler <14852918+phkahler@users.noreply.github.com> Date: Mon, 25 Jan 2021 20:41:28 -0500 Subject: [PATCH] Add version command to solvespace-cli --- src/platform/entrycli.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/platform/entrycli.cpp b/src/platform/entrycli.cpp index 61b20db..70b6919 100644 --- a/src/platform/entrycli.cpp +++ b/src/platform/entrycli.cpp @@ -4,6 +4,7 @@ // Copyright 2016 whitequark //----------------------------------------------------------------------------- #include "solvespace.h" +#include "config.h" static void ShowUsage(const std::string &cmd) { fprintf(stderr, "Usage: %s [filename...]", cmd.c_str()); @@ -29,6 +30,8 @@ Common options: Whether to export the background colour in vector formats. Defaults to off. Commands: + version + Prints the current solvespace version. thumbnail --output --size --view [--chord-tol ] Outputs a rendered view of the sketch, like the SolveSpace GUI would. @@ -174,7 +177,10 @@ static bool RunCommand(const std::vector args) { }; unsigned width = 0, height = 0; - if(args[1] == "thumbnail") { + if(args[1] == "version") { + fprintf(stderr, "SolveSpace version %s \n\n", PACKAGE_VERSION); + return false; + } else if(args[1] == "thumbnail") { auto ParseSize = [&](size_t &argn) { if(argn + 1 < args.size() && args[argn] == "--size") { argn++;