Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master committed Oct 18, 2024
1 parent 6ff4f7f commit 517ea96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use servo_config::opts::{default_opts, set_options, Opts};
/// Command line arguments.
#[derive(Clone, Debug, Default)]
pub struct CliArgs {
/// Url to load initially.
pub initial_url: Option<url::Url>,
/// URL to load initially.
pub url: Option<url::Url>,
}

/// Configuration of Verso instance.
Expand All @@ -25,14 +25,14 @@ pub struct Config {
/// Path to resources directory.
pub resource_dir: PathBuf,
/// Command line arguments.
pub cli_args: CliArgs,
pub args: CliArgs,
}

fn parse_cli_args() -> Result<CliArgs, getopts::Fail> {
let args: Vec<String> = std::env::args().collect();

let mut opts = getopts::Options::new();
opts.optopt("", "initial-url", "load this url on start", "url");
opts.optopt("", "url", "URL to load on start", "URL");

let matches = opts.parse(&args[1..])?;
let initial_url = matches
Expand All @@ -50,7 +50,7 @@ fn parse_cli_args() -> Result<CliArgs, getopts::Fail> {
}
});

Ok(CliArgs { initial_url })
Ok(CliArgs { url: initial_url })
}

impl Config {
Expand All @@ -61,7 +61,7 @@ impl Config {
Self {
opts,
resource_dir,
cli_args: parse_cli_args().unwrap_or_default(),
args: parse_cli_args().unwrap_or_default(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/verso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Verso {
pub fn new(evl: &ActiveEventLoop, proxy: EventLoopProxy<()>, config: Config) -> Self {
// Initialize configurations and Verso window
let protocols = config.create_protocols();
let initial_url = config.cli_args.initial_url.clone();
let initial_url = config.args.url.clone();
config.init();
// Reserving a namespace to create TopLevelBrowsingContextId.
PipelineNamespace::install(PipelineNamespaceId(0));
Expand Down

0 comments on commit 517ea96

Please sign in to comment.