Add version command to solvespace-cli

pull/914/head
phkahler 2021-01-25 20:41:28 -05:00
parent 2e1f5324c8
commit ebb194eda6
1 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@
// Copyright 2016 whitequark // Copyright 2016 whitequark
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "solvespace.h" #include "solvespace.h"
#include "config.h"
static void ShowUsage(const std::string &cmd) { static void ShowUsage(const std::string &cmd) {
fprintf(stderr, "Usage: %s <command> <options> <filename> [filename...]", cmd.c_str()); fprintf(stderr, "Usage: %s <command> <options> <filename> [filename...]", cmd.c_str());
@ -29,6 +30,8 @@ Common options:
Whether to export the background colour in vector formats. Defaults to off. Whether to export the background colour in vector formats. Defaults to off.
Commands: Commands:
version
Prints the current solvespace version.
thumbnail --output <pattern> --size <size> --view <direction> thumbnail --output <pattern> --size <size> --view <direction>
[--chord-tol <tolerance>] [--chord-tol <tolerance>]
Outputs a rendered view of the sketch, like the SolveSpace GUI would. Outputs a rendered view of the sketch, like the SolveSpace GUI would.
@ -174,7 +177,10 @@ static bool RunCommand(const std::vector<std::string> args) {
}; };
unsigned width = 0, height = 0; 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) { auto ParseSize = [&](size_t &argn) {
if(argn + 1 < args.size() && args[argn] == "--size") { if(argn + 1 < args.size() && args[argn] == "--size") {
argn++; argn++;