Skip to content

Commit b232b09

Browse files
authored
added CLI option --buildinfo (#188)
1 parent db3f4a8 commit b232b09

6 files changed

Lines changed: 47 additions & 6 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ Please remove the text down to this point before proceeding.
3232
[Replace this text with any useful Skyscraper terminal output that might help clarify your issue. For longer output use pastebin.com, ix.io or similiar.]
3333

3434
**Technical information**
35-
- Skyscraper version: [Replace with the Skyscraper version you are running, e.g. 3.9.1]
36-
- Configuration switches applied (config.ini, commandline, ...)
35+
- Configuration switches applied to Skyscraper (config.ini, commandline, ...)
3736
- Internet connection: [Replace with the type of internet you have, e.g. adsl, wifi, dialup, if your issue is scraper related]
38-
- OS and Version [Replace with the OS/stack and version you are running, e.g. RetroPie 4.8.5, 23.10.1, ...]
37+
- _Note_: For the next two items you may provide the output of `Skyscraper --buildinfo`
38+
(from v3.18 onwards) and add the RetroPie version if it is not printed with
39+
this command.
40+
- Skyscraper version: [Replace with the Skyscraper version you are running, e.g. 3.9.1]
41+
- OS and Version [Replace with the OS/stack and version you are running, e.g. RetroPie 4.8.5, 23.10.1, ...]
3942

4043
**Additional context**
4144
[Replace this text with any additional context that might help understand this issue better. Optional.]

docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ humans](https://keepachangelog.com).
1717
`'*.ext'` also allow `'.ext'` and `'ext'`
1818
- Added: Accept also singular for media flags, e.g. `--flags video` additionally
1919
to `--flags videos`. However, in the config file accept only plural as before.
20+
- Added: Flag [`--buildinfo`](CLIHELP.md#--buildinfo), comes in handy when
21+
reporting an issue.
2022
- Updated: macOS installation instructions to use Qt6
2123
- Updated: Docker uses Ubuntu 24.04 and Qt6
2224
- Updated: Documentation, added usage level for configuration options. See

docs/CLIHELP.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ Skyscraper -p snes -s thegamesdb --addext '*.ext1 *.ext2'
230230
Skyscraper -p snes -s thegamesdb --addext '.ext1 ext2'
231231
```
232232

233+
### --buildinfo
234+
235+
Show the build configuration and runtime environment of Skyscraper and exits. Use this info when reporting an issue. Thanks!
236+
233237
### --cache <COMMAND[:OPTIONS]>
234238

235239
This is the cache master option. It contains several subcommands that allows you to manipulate the cached data for the selected platform.

src/cli.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <QRandomGenerator>
3131
#include <QRegularExpression>
3232
#include <QStringBuilder>
33+
#include <QSysInfo>
3334

3435
void Cli::createParser(QCommandLineParser *parser, QString platforms) {
3536

@@ -239,9 +240,13 @@ void Cli::createParser(QCommandLineParser *parser, QString platforms) {
239240
"verbosity", "Print more info while scraping. Default: 0", "0-3", "0");
240241
QCommandLineOption hintOption("hint",
241242
"Show a random 'Tip of the Day' and quit.");
243+
QCommandLineOption buildinfoOption("buildinfo",
244+
"Show Skyscraper's build information "
245+
"(for reporting an issue) and quit.");
242246

243247
parser->addOption(addextOption);
244248
parser->addOption(aOption);
249+
parser->addOption(buildinfoOption);
245250
parser->addOption(cacheOption);
246251
parser->addOption(cOption);
247252
parser->addOption(dOption);
@@ -538,3 +543,24 @@ void Cli::showHint() {
538543

539544
printf("%s\n\n", hintWrapped.join("\n").toStdString().c_str());
540545
}
546+
547+
void Cli::showBuildinfo() {
548+
QStringList info;
549+
QString skyVer = "Skyscraper: " VERSION;
550+
#ifdef QT_DEBUG
551+
skyVer = skyVer % " (Debug)";
552+
#endif
553+
info.append(skyVer);
554+
info.append("Qt: " % QString::number(QT_VERSION_MAJOR) % "." %
555+
QString::number(QT_VERSION_MINOR) % "." %
556+
QString::number(QT_VERSION_PATCH));
557+
info.append("Architecture: " % QSysInfo::currentCpuArchitecture());
558+
info.append("Kernel: " % QSysInfo::kernelType() % " " %
559+
QSysInfo::kernelVersion());
560+
info.append("Operating System: " % QSysInfo::prettyProductName());
561+
QString rpVer = Config::getRetropieVersion();
562+
if (!rpVer.isEmpty()) {
563+
info.append("RetroPie: " % rpVer);
564+
}
565+
printf("%s\n", info.join("\n").toStdString().c_str());
566+
}

src/cli.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace Cli {
2929
QMap<QString, QString> getSubCommandOpts(const QString subCmd);
3030
void cacheReportMissingUsage();
3131
void showHint();
32+
void showBuildinfo();
3233
} // namespace Cli
3334

3435
#endif // CLI_H

src/settings.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void RuntimeCfg::applyConfigIni(CfgType type, QSettings *settings,
7676
bool isFlagsOK =
7777
parser->isSet("flags") && parseFlags().contains("help");
7878

79-
if (!isCacheOK && !isFlagsOK && !parser->isSet("hint")) {
79+
if (!isCacheOK && !isFlagsOK && !parser->isSet("hint") &&
80+
!parser->isSet("buildinfo")) {
8081
reportInvalidPlatform();
8182
exit(1);
8283
}
@@ -621,6 +622,10 @@ void RuntimeCfg::applyCli(bool &inputFolderSet, bool &gameListFolderSet,
621622
if (parser->isSet("refresh")) {
622623
config->refresh = true;
623624
}
625+
if (parser->isSet("buildinfo")) {
626+
Cli::showBuildinfo();
627+
exit(0);
628+
}
624629
if (parser->isSet("hint")) {
625630
Cli::showHint();
626631
exit(0);
@@ -786,12 +791,12 @@ QStringList RuntimeCfg::parseFlags() {
786791
"skipexistingmanual",
787792
"fanart",
788793
"video",
789-
"manual"};
794+
"manual",
795+
"miximage"};
790796
for (QString f : _flags) {
791797
retFlags << (plFlags.contains(f) ? f % "s" : f);
792798
}
793799
}
794-
qDebug() << "Flags:" << retFlags;
795800
return retFlags;
796801
}
797802

0 commit comments

Comments
 (0)