Fix warning in p_install_gh
when installing multiple packages
#122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the warning message mentioned in #118 when installing multiple packages with
p_install_gh()
.The code in
R/p_install_gh.R#L24
throws a warning message when passing a vector of repository names to thepackage
argument:p_install_gh(c('path/package', 'path2/repo'))
I propose the following changes:
p_loaded()
is using the package name to check, whether that package is loaded, the package name should be extracted from the Github path beforehand withparse_git_repo()
. (Becausep_install_gh()
passes a Github path (e.g. 'trinker/pacman') top_loaded()
.p_loaded()
always returnsFALSE
for Github paths.)parse_git_repo()
inR/utils.R#L194
from theremotes
package. It would act as an interface to call eitherremotes::parse_github_url()
orremotes::parse_repo_spec()
. The code forparse_git_repo()
is taken fromremotes/R/parse-git.R#L97
.parse_git_repo()
depends onviapply()
, therefore it is included fromremotes/R/utils.R#L8
as well.