diff --git a/.gitignore b/.gitignore index 0a03c95..db43345 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ vignettes/*.pdf *.knit.md .Rproj.user +*.DS_Store diff --git a/DESCRIPTION b/DESCRIPTION index f63ebed..97bd90b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,11 +9,11 @@ Description: Managing, inspecting and sourcing remote repositories such as githu Depends: R (>= 2.3.0) Imports: - jsonlite,jsTree,miniUI,shiny,httr,utils,tools,plyr,crayon + httr,utils,crayon,tools,rstudioapi License: GPL-2 | GPL-3 URL: https://github.com/metrumresearchgroup/vcs BugReports: https://github.com/metrumresearchgroup/options/issues LazyData: true NeedsCompilation: no Packaged: 2017-06-08 14:00:00 UTC; Yoni -RoxygenNote: 6.0.1.9000 +RoxygenNote: 6.0.1 diff --git a/NAMESPACE b/NAMESPACE index 757b945..b618922 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,8 +8,6 @@ export(grepr) export(gsubr) export(list_repos) export(ls_remote) -export(navigate_remote) -export(sasha) export(setwd_remote) export(source_remote) export(sparse_checkout) @@ -21,33 +19,6 @@ importFrom(httr,add_headers) importFrom(httr,content) importFrom(httr,http_error) importFrom(httr,parse_url) -importFrom(jsTree,jsTree) -importFrom(jsTree,jsTreeOutput) -importFrom(jsTree,renderJsTree) -importFrom(jsonlite,fromJSON) -importFrom(miniUI,gadgetTitleBar) -importFrom(miniUI,miniContentPanel) -importFrom(miniUI,miniPage) -importFrom(miniUI,miniTitleBarButton) -importFrom(shiny,actionButton) -importFrom(shiny,conditionalPanel) -importFrom(shiny,eventReactive) -importFrom(shiny,isolate) -importFrom(shiny,observeEvent) -importFrom(shiny,paneViewer) -importFrom(shiny,radioButtons) -importFrom(shiny,reactiveValues) -importFrom(shiny,renderPrint) -importFrom(shiny,renderUI) -importFrom(shiny,runGadget) -importFrom(shiny,selectInput) -importFrom(shiny,sidebarLayout) -importFrom(shiny,sidebarPanel) -importFrom(shiny,stopApp) -importFrom(shiny,textInput) -importFrom(shiny,uiOutput) -importFrom(shiny,verbatimTextOutput) -importFrom(shiny,wellPanel) importFrom(tools,file_path_as_absolute) importFrom(utils,head) importFrom(utils,tail) diff --git a/R/grep_remote.R b/R/grep_remote.R index 8e2e861..bf8565a 100644 --- a/R/grep_remote.R +++ b/R/grep_remote.R @@ -3,10 +3,12 @@ #' @param pattern character, string containing a regular expression #' @param path character, path to search, see details #' @param recursive boolean, Should the listing recurse into directories? passed to list.files, Default: FALSE -#' @param whole_word boolean, if TRUE then the pattern will be wrapped with \\bpattern\\b internally, Default: FALSE +#' @param ... arguments passed to grep +#' @param whole_word boolean, if TRUE then the pattern will be +#' wrapped with \\bpattern\\b internally, Default: FALSE #' @param padding integer, number of rows to return in addition to the query line, Default: 5 #' @param use_crayon boolean, use crayon colors in console output, Default: TRUE -#' @param ... arguments passed to grep +#' @param marker boolean, use rstudioapi marker, Default: interactive() #' @return grepr(value = FALSE) returns a vector of the indices of the elements of x #' that yielded a match (or not, for invert = TRUE. #' This will be an integer vector unless the input is a long vector, when it will be a double vector. @@ -26,14 +28,21 @@ #' grepr(pattern = 'importFrom',path = remotepath,value=TRUE) #' grepr(pattern = 'importFrom',path = remotepath,value=TRUE,padding=3) #' grepr(pattern = 'tags$script', -#' path = list(path = 'timelyportfolio/vueR',subdir='R|inst',vcs='github'), +#' path = list(path = 'timelyportfolio/vueR',subdir='R|inst',vcs='github',PAT = Sys.getenv('GITHUB_PAT')), #' padding=3,value=TRUE,fixed=TRUE)} #' @export #' @importFrom httr content GET parse_url #' @importFrom utils tail head #' @importFrom crayon green red -#' @importFrom jsTree jsTree -grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,use_crayon = TRUE, interactive=FALSE,marker = FALSE, ...){ +grepr <- function(pattern, + path, + recursive=FALSE, + ... , + whole_word = FALSE, + padding=1, + use_crayon = TRUE, + marker = interactive() + ){ if(marker) use_crayon <- FALSE @@ -69,7 +78,9 @@ grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,us out=sapply(fl,function(x){ args=grepVars args$pattern=pattern - if(is.null(args$value)||interactive) args$value=FALSE + if(is.null(args$value)){ + args$value <- FALSE + } args$x=switch(vcs, local= {readLines(x,warn = FALSE)}, @@ -79,7 +90,7 @@ grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,us s <- httr::content( httr::GET(x, httr::add_headers( - Authorization = sprintf('token %s',Sys.getenv('GHE_PAT')) + Authorization = sprintf('token %s',path$PAT) ) ) ) @@ -122,7 +133,7 @@ grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,us } gdx=sapply(g,function(x,pad,nmax) seq(from=pmax(1,x-pad),to=pmin(nmax,x+pad)),pad=padding,nmax=length(args$x)) out=unique(unlist(sapply(gdx,function(i){ - if(use_crayon&!interactive){ + if(use_crayon){ ifelse(i%in%g0,{ this_pat <- regexpr(pattern, args$x[i]) @@ -146,22 +157,6 @@ grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,us } }) - if(interactive & vcs%in%c('ghe','github','bitbucket') ){ - - s0 <- out[sapply(out,length)>0] - - NAMES <- gsub(sprintf('^(.*?)%s/|\\?(.*?)$',path$branch),'',names(s0)) - - tree <- jsTree::jsTree$new(ls_remote(path$path,vcs=vcs)) - - tree$current_nodestate <- tree$data%in%NAMES - tree$add_vcs(remote_repo = path$path,vcs = vcs,remote_branch = 'master') - tree$raw_token <- ghe_raw_token(path = path$path,file = tree$data[1],myPAT = Sys.getenv('GHE_PAT')) - tree$preview_search <- pattern - - tree$show() - - }else{ out <- out[sapply(out,length)>0] if(!marker){ @@ -173,7 +168,7 @@ grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,us } invisible(out) - } + } diff --git a/R/ls_remote.R b/R/ls_remote.R index d0bec21..8be1bc6 100644 --- a/R/ls_remote.R +++ b/R/ls_remote.R @@ -21,18 +21,25 @@ #' #'master' branch #' ls_remote('metrumrg/qapply',vcs='bitbucket') #' -ls_remote <- function(path=getwd(),branch='master',subdir=NULL,vcs='github', full.names=FALSE){ +ls_remote <- function( + path=getwd(), + branch='master', + subdir=NULL, + vcs='github', + full.names=FALSE, + PAT = Sys.getenv('GITHUB_PAT') + ){ + this_wd <- getwd() + switch(vcs, ghe={ - - myPAT <- Sys.getenv('GHE_PAT') - + get_git <- sprintf('https://ghe.metrumrg.com/api/v3/repos/%s/git/trees/%s?recursive=1',path,branch) x <- httr::GET(get_git, httr::add_headers( - Authorization = sprintf('token %s',myPAT) + Authorization = sprintf('token %s',PAT) ) ) @@ -62,15 +69,13 @@ ls_remote <- function(path=getwd(),branch='master',subdir=NULL,vcs='github', ful }, github={ - - myPAT <- Sys.getenv('GITHUB_PAT') - + uri_git <- sprintf('https://api.github.com/repos/%s',path) get_git <- sprintf('https://api.github.com/repos/%s/git/trees/%s%s',path,branch,'?recursive=1') - if(nzchar(myPAT)){ - uri_git <- sprintf('%s?access_token=%s',uri_git,Sys.getenv('GITHUB_PAT')) - get_git <- sprintf('%s&access_token=%s',get_git,Sys.getenv('GITHUB_PAT')) + if(nzchar(PAT)){ + uri_git <- sprintf('%s?access_token=%s',uri_git,PAT) + get_git <- sprintf('%s&access_token=%s',get_git,PAT) } chk_git <- httr::http_error(uri_git) @@ -92,8 +97,8 @@ ls_remote <- function(path=getwd(),branch='master',subdir=NULL,vcs='github', ful raw_git <- sprintf('https://raw.githubusercontent.com/%s/%s/%s',path,branch,s) - if(nzchar(myPAT)){ - dlPAT <- gsub('^(.*?)\\?','',httr::content(httr::GET(sprintf('https://api.github.com/repos/%s/contents/%s?access_token=%s',path,s[1],myPAT)))$download_url) + if(nzchar(PAT)){ + dlPAT <- gsub('^(.*?)\\?','',httr::content(httr::GET(sprintf('https://api.github.com/repos/%s/contents/%s?access_token=%s',path,s[1],PAT)))$download_url) if(!dlPAT%in%raw_git) raw_git <- sprintf('%s?%s',raw_git,dlPAT) } diff --git a/R/make_marker.R b/R/make_marker.R index 5426d01..0020cea 100644 --- a/R/make_marker.R +++ b/R/make_marker.R @@ -16,8 +16,9 @@ make_marker <- function(pattern,x){ lapply(x[[nx]],function(xx){ r <- as.numeric(gsub('\\D','',gsub(':(.*?)$','',xx))) + type <- ifelse(grepl('\\[',gsub(':(.*?)$','',xx)),'info','usage') l <- gsub('^(.*?):','',xx) - list(type='info',file=new_nx,line=r,column=1,message=l) + list(type=type,file=new_nx,line=r,column=1,message=l) }) }),recursive = FALSE), basePath = getwd(), diff --git a/R/navigate_remote.R b/R/navigate_remote.R deleted file mode 100644 index 01fd88e..0000000 --- a/R/navigate_remote.R +++ /dev/null @@ -1,30 +0,0 @@ -#' @title Visually inspect structure of git repository before initial fetch -#' @description Visually inpsect the directory structure of it before cloning/fetching/pulling -#' @param path character, Path to root directory of git repository or a name of a github/bitbucket repository, Default: setwd() -#' @param branch character, alias of the github/bitbucket branch to retrieve directory structure, Default: 'master' -#' @param vcs character, choose which version control system to search (github, bitbucket, git (head of checkout repo), svn), Default: 'github' -#' @param show_tree boolean, show jsTree widget output in viewer, Default: TRUE -#' @details -#' By default path assumes a local address, if path is a valid repository name eg 'tidyverse/glue' -#' then the pattern is checked on the specified pulic github repository -#' @return widget -#' @export -#' @importFrom jsTree jsTree -#' @examples -#' navigate_remote('tidyverse/glue') -#' navigate_remote('tidyverse/glue',branch='named_args') -#' @seealso -#' \code{\link[jsTree]{jsTree}} -navigate_remote <- function(path=getwd(), branch='master', vcs='github', show_tree = TRUE){ - - tree <- jsTree::jsTree$new(ls_remote(path = path,branch = branch,vcs = vcs)) - - tree$add_vcs(remote_repo = path,vcs = vcs,remote_branch = branch) - - if(show_tree){ - tree$show() - }else{ - invisible(tree) - } - -} \ No newline at end of file diff --git a/R/sasha.R b/R/sasha.R deleted file mode 100644 index 83a1b14..0000000 --- a/R/sasha.R +++ /dev/null @@ -1,218 +0,0 @@ -#' @title vcs UI -#' @description Shiny gadget for controlling, navigating and maintaining version control directories on local and remote repositories -#' @param rootpath root path to look for version control directories, Default: getwd() -#' @return nothing -#' @details Version control systems that can be accessed are git, github, bitbucket and svn. Throught this gadget you can do full and sparse checkout and update current vcs directory. -#' @examples -#' \dontrun{ -#' if(interactive()){ -#' sasha(getwd()) -#' } -#' } -#' @seealso -#' \code{\link[jsonlite]{fromJSON}} - -#' \code{\link[jsTree]{jsTreeOutput}},\code{\link[jsTree]{renderJsTree}} - -#' \code{\link[miniUI]{miniPage}},\code{\link[miniUI]{gadgetTitleBar}},\code{\link[miniUI]{miniTitleBarButton}},\code{\link[miniUI]{miniContentPanel}} - -#' \code{\link[shiny]{sidebarLayout}},\code{\link[shiny]{sidebarPanel}},\code{\link[shiny]{radioButtons}},\code{\link[shiny]{conditionalPanel}},\code{\link[shiny]{wellPanel}},\code{\link[shiny]{textInput}},\code{\link[shiny]{uiOutput}},\code{\link[shiny]{actionButton}},\code{\link[shiny]{reactiveValues}},\code{\link[shiny]{observeEvent}},\code{\link[shiny]{renderPrint}},\code{\link[shiny]{eventReactive}},\code{\link[shiny]{isolate}},\code{\link[shiny]{renderUI}},\code{\link[shiny]{verbatimTextOutput}},\code{\link[shiny]{selectInput}},\code{\link[shiny]{stopApp}},\code{\link[shiny]{runGadget}},\code{\link[shiny]{paneViewer}} - -#' \code{\link[vcs]{find.remote}},\code{\link[vcs]{diff_head}},\code{\link[vcs]{navigate_remote}},\code{\link[vcs]{sparse_checkout}} -#' @rdname sasha -#' @export -#' @importFrom jsonlite fromJSON -#' @importFrom jsTree jsTreeOutput renderJsTree -#' @importFrom miniUI miniPage gadgetTitleBar miniTitleBarButton miniContentPanel -#' @importFrom shiny sidebarLayout sidebarPanel radioButtons conditionalPanel wellPanel textInput uiOutput actionButton reactiveValues observeEvent renderPrint eventReactive isolate renderUI verbatimTextOutput selectInput stopApp runGadget paneViewer -sasha<-function(rootpath=getwd()){ -ui <- miniUI::miniPage( - miniUI::gadgetTitleBar('SASHA', - left = miniUI::miniTitleBarButton(inputId = "qt","Quit",primary = TRUE), - right=NULL), - miniUI::miniContentPanel( - shiny::sidebarLayout(sidebarPanel = - shiny::sidebarPanel( - shiny::radioButtons(inputId = 'dirType',label = 'Source',choices = c('Local','Remote'),selected = 'Local',inline = TRUE), - shiny::conditionalPanel("input.dirType=='Local'",{ - shiny::wellPanel( - shiny::textInput(inputId = 'localPath',label = 'Root Directory',placeholder = 'Enter Root Directory',value = rootpath), - shiny::uiOutput('localDir'), - shiny::actionButton('updateRepo','Update Checkout')) - }), - shiny::conditionalPanel("input.dirType=='Remote'",{ - shiny::wellPanel( - shiny::textInput(inputId='remotePath',label = 'Remote Repository'), - shiny::radioButtons(inputId = 'vcs',label = 'Remote Version Control Sytem',choices = c('git','github','bitbucket','svn'),selected = 'github',inline = TRUE), - shiny::actionButton('queryRepo','Query Remote Repo'), - shiny::textInput('dirOutput','',placeholder = 'Path of Checkout'), - shiny::actionButton('createRepo','Create Sparse Checkout')) - }), - shiny::uiOutput('chosen') - ), - mainPanel = shiny::mainPanel( - shiny::uiOutput('main') - )) - - -)) - -server <- function(input, output,session) { - - network <- shiny::reactiveValues() - - shiny::observeEvent(input$tree_update,{ - current_selection<-input$tree_update$.current_tree - if(!is.null(current_selection)) network$tree <- jsonlite::fromJSON(current_selection) - }) - - shiny::observeEvent(network$tree,{ - output$results <- shiny::renderPrint({ - str.out='' - if(length(network$tree)>0) str.out=network$tree - return(str.out) - }) - }) - - shiny::observeEvent(c(input$f1,input$queryRepo),{ - output$results <- shiny::renderPrint({ - str.out='' - return(str.out) - }) - }) - - remote.current<-shiny::eventReactive(input$localPath,{ - root<-shiny::isolate(input$localPath) - find.remote(root) - }) - - shiny::observeEvent(c(remote.current(),input$dirType,input$queryRepo),{ - - output$tree <- switch(input$dirType, - Local={ - jsTree::renderJsTree({ - vcs_type='git' - rc<-remote.current() - vcs_type=rc[rc$dir==input$f1,'vcs'] - opts=NULL - if(!is.null(input$f1)){ - - tree <- navigate_remote(isolate(input$f1),vcs=vcs_type, show = FALSE) - - if(dir.exists(input$f1)){ - - tree$current_nodestate <- diff_head(isolate(input$f1)) - - } - - tree$show() - - } - }) - }, - Remote={ - jsTree::renderJsTree({ - if(nchar(isolate(input$remotePath))>0){ - shiny::isolate(navigate_remote(input$remotePath,vcs=input$vcs)) - } - }) - }) - - }) - - shiny::observeEvent(input$f1,{ - output$main<-shiny::renderUI({ - if(dir.exists(input$f1)){ - jsTree::jsTreeOutput(outputId = 'tree',width = '100%',height = 800) - }else{ - p('Directory Not Found') - } - }) - }) - - shiny::observeEvent(c(input$createRepo),{ - if(!is.null(input$f1)){ - switch(input$vcs, - github={ - repo_url<-sprintf('https://github.com/%s.git',input$remotePath) - f2<-gsub(sprintf('%s/%s',input$f1,'master'),'',network$tree) - queries<-gsub('^(.*?)master/','',f2) - this.vcs<-'git' - }, - bitbucket={ - repo_url<-sprintf('https://bitbucket.com/%s.git',input$remotePath) - f2<-gsub(sprintf('%s/%s',input$f1,'master'),'',network$tree) - queries<-gsub('^(.*?)master/','',f2) - this.vcs<-'git' - }, - svn={ - repo_url<-sprintf('svn+ssh://%s',input$remotePath) - f2<-gsub(sprintf('%s/%s',input$f1,'master'),'',network$tree) - this.vcs<-'svn' - }) - - # if(dir.exists(sprintf('%s/.git',input$dirOutput))){ - # sparse_checkout(repo_url = repo_url, - # vcs = this.vcs, - # queries = queries, - # dest.dir = input$dirOutput, - # create = FALSE, - # append = FALSE) - # }else{ - sparse_checkout(repo_url = repo_url, - vcs = this.vcs, - queries = queries, - dest.dir = input$dirOutput, - create = TRUE) - #} - - } - }) - - shiny::observeEvent(c(input$updateRepo),{ - - rc<-remote.current() - this.vcs=rc[rc$dir==input$f1,'vcs'] - if(!is.null(input$f1)){ - switch(this.vcs, - git={ - repo_url<-sprintf('https://github.com/%s.git',input$remotePath) - f2<-gsub(sprintf('%s/%s',input$f1,'master'),'',network$tree) - queries<-gsub('^(.*?)master/','',f2) - this.vcs<-'git' - }, - svn={ - repo_url<-sprintf('svn+ssh://%s',input$remotePath) - f2<-gsub(sprintf('%s/%s',input$f1,'master'),'',network$tree) - this.vcs<-'svn' - }) - if(dir.exists(sprintf('%s/.%s',input$f1,this.vcs))){ - sparse_checkout(repo_url = repo_url, - vcs = this.vcs, - queries = queries, - dest.dir = input$f1, - create = FALSE, - append = FALSE) - } - - } - }) - - - output$chosen=shiny::renderUI({ - shiny::verbatimTextOutput(outputId = "results") - }) - - output$localDir<-shiny::renderUI({ - rc<-remote.current() - shiny::selectInput(inputId = 'f1', - label = 'Choose Local Repository', - choices = rc$dir, - selected = rc$dir[1]) - }) - - shiny::observeEvent(input$qt,{shiny::stopApp()}) -} - -shiny::runGadget(ui, server, viewer = shiny::paneViewer(minHeight = 450)) -} \ No newline at end of file diff --git a/R/utils.R b/R/utils.R index 4705500..020ac32 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,11 +1,11 @@ #' @export -ghe_raw_token <- function(path,file,myPAT = Sys.getenv('GHE_PAT')){ +ghe_raw_token <- function(path,file,PAT = Sys.getenv('GHE_PAT')){ dl_git <- sprintf('https://ghe.metrumrg.com/api/v3/repos/%s/contents/%s',path,file) x1 <- httr::GET(dl_git, httr::add_headers( - Authorization = sprintf('token %s',myPAT) + Authorization = sprintf('token %s',PAT) ) ) diff --git a/README.md b/README.md index a56e8bd..9eba056 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ devtools::install_github('metrumresearchgroup/vcs') - **gsubr**: run recursive gsub directly on local paths - **list_repos**: list repositories of a user in a version control repository - **ls_remote**: list files on remote branches on a version control repository - - **navigate_remote**: visualize the structure of a remote branch prior to cloning/forking - **setwd_remote**: replace inline script from local path to remote path - **source_remote**: source script on remote branches, works for reading in data on remote and nested sourcing @@ -22,44 +21,3 @@ devtools::install_github('metrumresearchgroup/vcs') - **diff_head**: query the difference in files between current fetch and the HEAD of a repository - **sparse_checkout**: create a sparse checkout of a repository on github/bitbucket/svn - **update_depth**: if the git repository was checked out with a depth setting, use this function to update or cancel the depth setting - -## GUI - -### Interactive recursive grep - - - Run recursive grep directly on remote branches of Github/Bitbucket/SVN and inspect the results using an interactive UI. - - Preview* text files in the branch without needing to checkout (Github/BitBucket only) - - The search term inputed will be used in the preview in a search textbox to highlight the term in document. The user can then continue and use the search box to search for other terms int he text. - -![](https://github.com/yonicd/jsTree/blob/master/Miscellaneous/jstree_vcs_grepr.gif?raw=true) - -### Sasha - -Alexa for R! - -Let Sasha help you control your version control repositories both on your checkouts and on the master. Just point Sasha to a root path where the repositories are set and the rest is done for you. - - - Toggle between local checkouts and remote repos - - - Local - - - Auto recognition of svn and git parent folders - - Checks to see what the current (sparse) checkout is compared to HEAD - - Users can update the definitions of the (sparse) checkout through the GUI - - - Remote - - Navigate to any online repository on Github, Bitbucket or SVN - - View the structure of a branch in the repo - - Preview* text files in the branch without needing to checkout (Github/BitBucket only) - - Search within previewed file for text - - Select files to create (sparse) checkout and check them out to local path of choice - -![](https://github.com/yonicd/vcs/blob/master/Miscellaneous/sasha.gif?raw=true) - -### *Limitations - - Limitations of the the internal viewer of RStudio Preview and how it limits the functionality of the [jsTree](https://github.com/metrumresearchgroup/jsTree) package (that is the engine of the VCS GUI): - - - **mac OS** internal viewer does not allow for user defined context menus. So you can't right click on a file in the tree and preview, you need to use the preview button above the tree. This forces you to preview the first file it finds with a filled checkbox. - - **windows OS** internal viewer does not allow to read files from online so no preview. - \ No newline at end of file diff --git a/man/grepr.Rd b/man/grepr.Rd index 8a84345..dbc2dfa 100644 --- a/man/grepr.Rd +++ b/man/grepr.Rd @@ -4,8 +4,8 @@ \alias{grepr} \title{Recursive grep} \usage{ -grepr(pattern, path, recursive = FALSE, whole_word = FALSE, padding = 0, - use_crayon = TRUE, interactive = FALSE, marker = FALSE, ...) +grepr(pattern, path, recursive = FALSE, ..., whole_word = FALSE, + padding = 1, use_crayon = TRUE, marker = interactive()) } \arguments{ \item{pattern}{character, string containing a regular expression} @@ -14,13 +14,16 @@ grepr(pattern, path, recursive = FALSE, whole_word = FALSE, padding = 0, \item{recursive}{boolean, Should the listing recurse into directories? passed to list.files, Default: FALSE} -\item{whole_word}{boolean, if TRUE then the pattern will be wrapped with \\bpattern\\b internally, Default: FALSE} +\item{...}{arguments passed to grep} + +\item{whole_word}{boolean, if TRUE then the pattern will be +wrapped with \\bpattern\\b internally, Default: FALSE} \item{padding}{integer, number of rows to return in addition to the query line, Default: 5} \item{use_crayon}{boolean, use crayon colors in console output, Default: TRUE} -\item{...}{arguments passed to grep} +\item{marker}{boolean, use rstudioapi marker, Default: interactive()} } \value{ grepr(value = FALSE) returns a vector of the indices of the elements of x @@ -47,6 +50,6 @@ grepr(pattern = 'importFrom',path = remotepath) grepr(pattern = 'importFrom',path = remotepath,value=TRUE) grepr(pattern = 'importFrom',path = remotepath,value=TRUE,padding=3) grepr(pattern = 'tags$script', - path = list(path = 'timelyportfolio/vueR',subdir='R|inst',vcs='github'), + path = list(path = 'timelyportfolio/vueR',subdir='R|inst',vcs='github',PAT = Sys.getenv('GITHUB_PAT')), padding=3,value=TRUE,fixed=TRUE)} } diff --git a/man/ls_remote.Rd b/man/ls_remote.Rd index b087c8c..b15f40a 100644 --- a/man/ls_remote.Rd +++ b/man/ls_remote.Rd @@ -5,7 +5,7 @@ \title{Inspect directory structure of version control system repository} \usage{ ls_remote(path = getwd(), branch = "master", subdir = NULL, - vcs = "github", full.names = FALSE) + vcs = "github", full.names = FALSE, PAT = Sys.getenv("GITHUB_PAT")) } \arguments{ \item{path}{character, Path to root directory of git/svn repository or a name of a github/bitbucket repository, Default: setwd()} diff --git a/man/navigate_remote.Rd b/man/navigate_remote.Rd deleted file mode 100644 index 1e8dca1..0000000 --- a/man/navigate_remote.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/navigate_remote.R -\name{navigate_remote} -\alias{navigate_remote} -\title{Visually inspect structure of git repository before initial fetch} -\usage{ -navigate_remote(path = getwd(), branch = "master", vcs = "github", - show_tree = TRUE) -} -\arguments{ -\item{path}{character, Path to root directory of git repository or a name of a github/bitbucket repository, Default: setwd()} - -\item{branch}{character, alias of the github/bitbucket branch to retrieve directory structure, Default: 'master'} - -\item{vcs}{character, choose which version control system to search (github, bitbucket, git (head of checkout repo), svn), Default: 'github'} - -\item{show_tree}{boolean, show jsTree widget output in viewer, Default: TRUE} -} -\value{ -widget -} -\description{ -Visually inpsect the directory structure of it before cloning/fetching/pulling -} -\details{ -By default path assumes a local address, if path is a valid repository name eg 'tidyverse/glue' -then the pattern is checked on the specified pulic github repository -} -\examples{ -navigate_remote('tidyverse/glue') -navigate_remote('tidyverse/glue',branch='named_args') -} -\seealso{ -\code{\link[jsTree]{jsTree}} -} diff --git a/man/sasha.Rd b/man/sasha.Rd deleted file mode 100644 index b120d58..0000000 --- a/man/sasha.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sasha.R -\name{sasha} -\alias{sasha} -\title{vcs UI} -\usage{ -sasha(rootpath = getwd()) -} -\arguments{ -\item{rootpath}{root path to look for version control directories, Default: getwd()} -} -\value{ -nothing -} -\description{ -Shiny gadget for controlling, navigating and maintaining version control directories on local and remote repositories -} -\details{ -Version control systems that can be accessed are git, github, bitbucket and svn. Throught this gadget you can do full and sparse checkout and update current vcs directory. -} -\examples{ -\dontrun{ -if(interactive()){ - sasha(getwd()) - } -} -} -\seealso{ -\code{\link[jsonlite]{fromJSON}} - \code{\link[jsTree]{jsTreeOutput}},\code{\link[jsTree]{renderJsTree}} - \code{\link[miniUI]{miniPage}},\code{\link[miniUI]{gadgetTitleBar}},\code{\link[miniUI]{miniTitleBarButton}},\code{\link[miniUI]{miniContentPanel}} - \code{\link[shiny]{sidebarLayout}},\code{\link[shiny]{sidebarPanel}},\code{\link[shiny]{radioButtons}},\code{\link[shiny]{conditionalPanel}},\code{\link[shiny]{wellPanel}},\code{\link[shiny]{textInput}},\code{\link[shiny]{uiOutput}},\code{\link[shiny]{actionButton}},\code{\link[shiny]{reactiveValues}},\code{\link[shiny]{observeEvent}},\code{\link[shiny]{renderPrint}},\code{\link[shiny]{eventReactive}},\code{\link[shiny]{isolate}},\code{\link[shiny]{renderUI}},\code{\link[shiny]{verbatimTextOutput}},\code{\link[shiny]{selectInput}},\code{\link[shiny]{stopApp}},\code{\link[shiny]{runGadget}},\code{\link[shiny]{paneViewer}} - \code{\link[vcs]{find.remote}},\code{\link[vcs]{diff_head}},\code{\link[vcs]{navigate_remote}},\code{\link[vcs]{sparse_checkout}} -}