mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Add --version
flag
This commit is contained in:
parent
3ab5c07559
commit
d76ffa8fd8
3 changed files with 30 additions and 0 deletions
|
@ -205,6 +205,9 @@ pub struct Opts {
|
|||
|
||||
// don't skip any backtraces on panic
|
||||
pub full_backtraces: bool,
|
||||
|
||||
/// Print the version and exit.
|
||||
pub is_printing_version: bool,
|
||||
}
|
||||
|
||||
fn print_usage(app: &str, opts: &Options) {
|
||||
|
@ -527,6 +530,7 @@ pub fn default_opts() -> Opts {
|
|||
render_api: DEFAULT_RENDER_API,
|
||||
config_dir: None,
|
||||
full_backtraces: false,
|
||||
is_printing_version: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,6 +588,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
opts.optopt("G", "graphics", "Select graphics backend (gl or es2)", "gl");
|
||||
opts.optopt("", "config-dir",
|
||||
"config directory following xdg spec on linux platform", "");
|
||||
opts.optflag("v", "version", "Display servo version information");
|
||||
|
||||
|
||||
let opt_match = match opts.parse(args) {
|
||||
|
@ -776,6 +781,8 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
_ => args_fail(&format!("error: graphics option must be gl or es2:")),
|
||||
};
|
||||
|
||||
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
|
||||
|
||||
let opts = Opts {
|
||||
is_running_problem_test: is_running_problem_test,
|
||||
url: Some(url),
|
||||
|
@ -831,6 +838,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
use_msaa: debug_options.use_msaa,
|
||||
config_dir: opt_match.opt_str("config-dir"),
|
||||
full_backtraces: debug_options.full_backtraces,
|
||||
is_printing_version: is_printing_version,
|
||||
};
|
||||
|
||||
set_defaults(opts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue