mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Add detailed version information to --version command line option
Similar to About > Version, used to provide more information after ci builds Also --usage is added as synonimous for --help for completeness
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "GcUpgrade.h"
|
||||
#include "IdleTimer.h"
|
||||
#include "PowerProfile.h"
|
||||
#include "GcCrashDialog.h" // for versionHTML
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
@@ -207,12 +208,20 @@ main(int argc, char *argv[])
|
||||
// honour command line switches
|
||||
foreach (QString arg, sargs) {
|
||||
|
||||
// help or version requested
|
||||
if (arg == "--help" || arg == "--version") {
|
||||
// help, usage or version requested, basic information
|
||||
if (arg == "--help" || arg == "--usage" || arg == "--version") {
|
||||
|
||||
help = true;
|
||||
fprintf(stderr, "GoldenCheetah %s (%d)\nusage: GoldenCheetah [[directory] athlete]\n\n", VERSION_STRING, VERSION_LATEST);
|
||||
fprintf(stderr, "--help or --version to print this message and exit\n");
|
||||
fprintf(stderr, "GoldenCheetah %s (%d)\n", VERSION_STRING, VERSION_LATEST);
|
||||
|
||||
}
|
||||
|
||||
// help or usage requrested, additional information
|
||||
if (arg == "--help" || arg == "--usage") {
|
||||
|
||||
fprintf(stderr, "usage: GoldenCheetah [[directory] athlete]\n\n");
|
||||
fprintf(stderr, "--help or --usage to print this message and exit\n");
|
||||
fprintf(stderr, "--version to print detailed version information and exit\n");
|
||||
fprintf(stderr, "--newgui to open the new gui (WIP)\n");
|
||||
#ifdef GC_WANT_HTTP
|
||||
fprintf(stderr, "--server to run as an API server\n");
|
||||
@@ -234,6 +243,16 @@ main(int argc, char *argv[])
|
||||
fprintf (stderr, "\nSpecify the folder and/or athlete to open on startup\n");
|
||||
fprintf(stderr, "If no parameters are passed it will reopen the last athlete.\n\n");
|
||||
|
||||
// version requested, additional information
|
||||
} else if (arg == "--version") {
|
||||
|
||||
QString html = GcCrashDialog::versionHTML();
|
||||
html.replace("</td><td>", ": "); // to maintain colums in one line
|
||||
QString text = QTextDocumentFragment::fromHtml(html).toPlainText();
|
||||
QByteArray ba = text.toLocal8Bit();
|
||||
const char *c_str = ba.data();
|
||||
fprintf(stderr, "\n%s\n\n", c_str);
|
||||
|
||||
} else if (arg == "--newgui") {
|
||||
newgui = true;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ if [ ! -x ./GoldenCheetah ]
|
||||
then echo "Build GoldenCheetah and execute from distribution src"; exit 1
|
||||
fi
|
||||
echo "Checking GoldenCheetah.app can execute"
|
||||
./GoldenCheetah --help
|
||||
./GoldenCheetah --version
|
||||
|
||||
### Create AppDir and start populating
|
||||
mkdir -p appdir
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set -ev
|
||||
cd src
|
||||
echo "Checking GoldenCheetah.app can execute"
|
||||
GoldenCheetah.app/Contents/MacOS/GoldenCheetah --help
|
||||
GoldenCheetah.app/Contents/MacOS/GoldenCheetah --version
|
||||
echo "About to create dmg file and fix up"
|
||||
# This is a hack to include libicudata.64.dylib, not handled by macdployqt[fix]
|
||||
mkdir GoldenCheetah.app/Contents/Frameworks
|
||||
@@ -30,7 +30,7 @@ ls -l $FINAL_NAME
|
||||
echo "Mounting dmg file and testing it can execute"
|
||||
hdiutil mount $FINAL_NAME
|
||||
cd /Volumes/GoldenCheetah
|
||||
GoldenCheetah.app/Contents/MacOS/GoldenCheetah --help
|
||||
GoldenCheetah.app/Contents/MacOS/GoldenCheetah --version
|
||||
echo "Uploading for user tests"
|
||||
curl --upload-file $TRAVIS_BUILD_DIR/src/$FINAL_NAME https://transfer.sh/$FINAL_NAME
|
||||
echo "Make sure we are back in the Travis build directory"
|
||||
|
||||
Reference in New Issue
Block a user