Skip to content

Conversation

oriongonza
Copy link
Contributor

Allows the user to download the webdriver to a specific directory.

Description

Adds the --save-path flag, which allows the user to download the selected driver to a folder.

Also a few refactors that I didn't see in the other PR

Motivation and Context

I had the need for this so I implemented it here.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
@CLAassistant
Copy link

CLAassistant commented Mar 29, 2023

CLA assistant check
All committers have signed the CLA.

@oriongonza
Copy link
Contributor Author

@bonigarcia you might want to take a look at this two PRs #11832

@titusfortner titusfortner requested a review from bonigarcia March 30, 2023 15:11
Copy link
Member

@bonigarcia bonigarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should not be merged. The flag --save-path is not necessary, since the feature to change the binary path will be implemented through the flag --cache-path (planned in #11688, which has a current PR under review: #11840).

@oriongonza
Copy link
Contributor Author

This might still be useful (it is at least for me) since the webdriver will be saved under a specific version folder eg ~/mycache/111.xxx.xxx/chromedriver.

@oriongonza
Copy link
Contributor Author

Still, even if this gets pushed back there are a few refactors worth considering, especially using #[Derive(Clone)] attribute macro.
By the way, why does the get_config clone the configuration struct instead of returning a mutable reference to it? That way you can simplify (and speed up but that doesn't really matter) the addding of a new configuration.

Also it might be worth considering using optionals instead of empty strings for the configurations that don't exist since rust provides really powerful tools for working with options,

@bonigarcia
Copy link
Member

bonigarcia commented Apr 4, 2023

This might still be useful (it is at least for me) since the webdriver will be saved under a specific version folder eg ~/mycache/111.xxx.xxx/chromedriver.

I see your point now. Still, I think having both flags --cache-path and --save-path can be confusing. Instead, I propose having only --cache-path (which it has already another PR), and created another extra flag e.g. called --avoid-driver-tree to store the driver without using a tree folder for the drivers. @dev-ardi What do you think?

@bonigarcia
Copy link
Member

Still, even if this gets pushed back there are a few refactors worth considering, especially using #[Derive(Clone)] attribute macro. By the way, why does the get_config clone the configuration struct instead of returning a mutable reference to it? That way you can simplify (and speed up but that doesn't really matter) the addding of a new configuration.

Yes, I have just seen your PR about it and it seems a handy way to avoid the cloning method, thanks a lot. I think we should merge it, thanks.

Also it might be worth considering using optionals instead of empty strings for the configurations that don't exist since rust provides really powerful tools for working with options,

Yes, that is a good idea too.

@diemol
Copy link
Member

diemol commented Apr 4, 2023

I got lost a bit. What should we do with this PR? I believe it needs to be split to handle the refactor apart?

@oriongonza
Copy link
Contributor Author

I see your point now. Still, I think having both flags --cache-path and --save-path can be confusing. Instead, I propose having only --cache-path (which it has already another PR), and created another extra flag e.g. called --avoid-driver-tree to store the driver without using a tree folder for the drivers. @dev-ardi What do you think?

That looks like the correct approach

@oriongonza
Copy link
Contributor Author

I got lost a bit. What should we do with this PR? I believe it needs to be split to handle the refactor apart?

I guess so. I don't know how to select only some of the changes from each commit, I'm very good with git. I could use some help with this :)

@diemol
Copy link
Member

diemol commented Apr 4, 2023

You can create a complete new branch from trunk and only apply the refactoring changes to send a PR.

@oriongonza oriongonza mentioned this pull request Apr 15, 2023
8 tasks
@oriongonza oriongonza closed this Apr 15, 2023
@oriongonza oriongonza deleted the save-to-dir branch April 15, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants