#' Display Package Description
#' 
#' @param pname name of package
#' 
#' @examples
#' package_description("lazy.tools")
#' 
#' @export
#' 

package_description <- function( pname ){
 # Display Package Description
 # Shin-ichi Mayekawa
 # 20240331
 # 
 
 # exists?
 if( !(pname %in% installed.packages()) ){
  cat("error1:(packageDescription) Package", pname, "is not installed.\n")
  return()
 }
 
 # read DESCRIPTION
 ds=readLines(system.file("DESCRIPTION", package=pname))
 
 loc=which( regexpr("Built:", ds,fixed=TRUE) > 0 )
 dd=ds[loc]
 ymdhms=strsplit(dd,";")[[1]][3]

 # Print(strsplit(dd,";")[[1]])
 # Print(pname,loc, dd)
 
 ymdhmsP=as.POSIXct(ymdhms, tz="UTC", format="%Y-%m-%d %H:%M:%OS ")
 
 ymdhmsJST=paste( as.character( as.POSIXct(ymdhmsP, tz="Asia/Tokyo") ),"JST")
 
 #Print(ymdhms,"/",ymdhmsJST)
 
 cat("\n")
 writeLines(ds)
 cat("\nThe Package was built on ", ymdhmsJST, ".\n\n", sep="")
 
} # end of package_description


