-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7e579f
commit 4ab77fa
Showing
5 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#' A changelog markdown template to document project progress | ||
#' | ||
#' @param path Path where markdown file is created | ||
#' @param confirm Confirm path; logical input. | ||
#' | ||
#' @return Return markdown file in specified or current working directory | ||
#' @export | ||
#' | ||
#' @examples | ||
#' init_changelog_md() | ||
init_changelog_md <- function(path = getwd(), confirm = TRUE){ | ||
|
||
|
||
# Display a message before the prompt | ||
cat("You current working directory will be:\n") | ||
cat(path) | ||
|
||
if(confirm){ | ||
user_input <- tolower( | ||
readline( | ||
prompt = "Do you wish to create a Change log MD here? (y/yes to confirm): " | ||
) | ||
) | ||
}else{ | ||
user_input <- "y" | ||
} | ||
|
||
|
||
# Check if the user input is 'y' or 'yes' | ||
if (user_input %in% c("y", "yes")) { | ||
wd_path <- path | ||
|
||
markdown_content <- " | ||
# CHANGELOG | ||
``` txt | ||
YYYY-MM-DD John Doe | ||
* Big Change 1 | ||
* Another Change 2 | ||
``` | ||
" | ||
aa <- file.path(wd_path,"CHANGELOG.md") | ||
file.create(aa, showWarnings = FALSE) | ||
|
||
if(file.exists(aa)){ | ||
fileConn <- file(aa) | ||
|
||
writeLines( | ||
markdown_content, | ||
fileConn | ||
) | ||
close(fileConn) | ||
|
||
} | ||
|
||
} else { | ||
cat("Change log MD initialization canceled.\n") | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
inst/markdown/templates/changelog_md_template/skeleton/skeleton.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# CHANGELOG | ||
|
||
``` txt | ||
YYYY-MM-DD John Doe | ||
* Big Change 1 | ||
* Another Change 2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "CHANGELOG MD" | ||
description: "A template to document project progress" | ||
create_dir: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.