Add new --report/-R switch to generate an info dump for bug reports

This is intended to be used instead of the Game Version dialog's
clipboard text report in the event that Wesnoth cannot reach the
titlescreen or the dialog for some reason.

Unlike the --version info dump, it performs various calls to the
filesystem API which have potential side-effects on the environment
(namely, creating a user data directory structure if none existed before
running the command). It seems highly improper for a program's --version
switch to perform any actions other than printing text to its parent
terminal, hence I thought it would be better to add a new switch with a
more active phrasing, also reflected in its accompanying documentation.

Ultimately, this and its UI counterpart should be used by 1.14 players
as part of the bug reporting process, preferably as a mandatory step
before submitting new reports on GH or the forums.
This commit is contained in:
Ignacio R. Morelle 2017-05-21 22:28:41 -04:00
parent 5ed8dc3847
commit 98883d0d0c
4 changed files with 14 additions and 0 deletions

View file

@ -229,6 +229,9 @@ sets the screen resolution. Example:
.BI --render-image \ image \ output
takes a valid wesnoth 'image path string' with image path functions, and outputs to a windows .bmp file.
.TP
.BI -R,\ --report
initializes game directories, prints build information suitable for use in bug reports, and exits.
.TP
.BI --rng-seed \ seed
seeds the random number generator with number <arg>.
Example:

View file

@ -133,6 +133,7 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
userdata_dir(),
validcache(false),
version(false),
report(false),
windowed(false),
with_replay(false),
args_(args.begin() + 1 , args.end()),
@ -177,6 +178,7 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
" Implies --wconsole."
#endif // _WIN32
)
("report,R", "initializes game directories, prints build information suitable for use in bug reports, and exits.")
("rng-seed", po::value<unsigned int>(), "seeds the random number generator with number <arg>. Example: --rng-seed 0")
("screenshot", po::value<two_strings>()->multitoken(), "takes two arguments: <map> <output>. Saves a screenshot of <map> to <output> without initializing a screen. Editor must be compiled in for this to work."
#ifdef _WIN32
@ -435,6 +437,8 @@ commandline_options::commandline_options (const std::vector<std::string>& args)
username = vm["username"].as<std::string>();
if (vm.count("password"))
password = vm["password"].as<std::string>();
if (vm.count("report"))
report = true;
if (vm.count("side"))
multiplayer_side = parse_to_uint_string_tuples_(vm["side"].as<std::vector<std::string> >());
if (vm.count("test"))

View file

@ -207,6 +207,8 @@ public:
bool validcache;
/// True if --version was given on the command line. Prints version and exits.
bool version;
/// True if --report was given on the command line. Prints a bug report-style info dump and exits.
bool report;
/// True if --windowed was given on the command line. Starts Wesnoth in windowed mode.
bool windowed;
/// True if --with-replay was given on the command line. Shows replay of the loaded file.

View file

@ -448,6 +448,11 @@ static int process_command_args(const commandline_options& cmdline_opts) {
return 0;
}
if(cmdline_opts.report) {
std::cout << "\n========= BUILD INFORMATION =========\n\n"
<< game_config::full_build_report();
return 0;
}
// Options changing their behavior dependent on some others should be checked below.