R/helper_ssh_functions.R

Defines functions get_project_folder get_super_folder get_project_name get_available_accounts

Documented in get_available_accounts get_project_folder get_project_name get_super_folder

#' Get your p number
#'
#' @return a string with p number
#' @export
get_available_accounts <- function() {
  p_number <- "p282067"
  p_number
}

#' Get name of project you're working on
#'
#' @param project String with the name of project to be worked on.
#'
#' @return String with project name
#' @author Giovanni Laudanno, Pedro Neves
#' @export
#'
#' @examples utilSIE::get_project_name()
get_project_name <- function(project = "DAISIE") {
  assertthat::is.string(project)
  project_name <- project
  project_name
}

#' Get path of projects superfolder
#'
#' @return String with path of superfolder.
#' @export
#'
#' @examples utilSIE::get_super_folder()
get_super_folder <- function() {
  super_folder <- file.path("D:", "Projects")
  super_folder
}

#' @title Get project folder address
#'
#' @param project_name String containing project name as returned by
#'  \code{\link{get_project_name}}
#' @export
#'
#' @author Giovanni Laudanno
#' @description Get project folder address
#' @return project folder address
get_project_folder <- function(project_name = utilSIE::get_project_name()) {
  db_dir <- utilSIE::get_super_folder()
  home_dir <- db_dir
  home_files <- list.files(paste0(home_dir))
  project_folder <- home_files[which(grepl(
    pattern = project_name,
    x = home_files
  ))]
  project_folder <- file.path(home_dir, project_folder)
  project_folder
}
Neves-P/utilSIE documentation built on Nov. 20, 2019, 7 a.m.