Skip to content

Commit

Permalink
Enhance deadliners a little
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Jun 24, 2024
1 parent 0f7e684 commit 4325b43
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-06-24 Dirk Eddelbuettel <[email protected]>

* inst/examples/deadliners.r: A little formatting and colour

2024-06-12 Dirk Eddelbuettel <[email protected]>

* inst/examples/deadliners.r: Minimal 'Deadline' field printer
Expand Down
18 changes: 17 additions & 1 deletion inst/examples/deadliners.r
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@
#
# Released under GPL (>= 2)

## borrowed with love from tinytest and marginally extended
.color_str <- function(x, color){
cmap <- c(cyan=36, red=31, green=32, blue=34, purple=35)
sprintf("\033[0;%dm%s\033[0m", cmap[color], x)
}
.blue <- function(txt) .color_str(txt, "blue")
.purple <- function(txt) .color_str(txt, "purple")

db <- as.data.frame(tools::CRAN_package_db())
dd <- with(db, db[!is.na(Deadline), c("Package", "Version", "Deadline")])
dd <- with(dd, dd[order(Deadline, Package), ])
print(dd, row.names=FALSE)

dts <- unique(dd[, "Deadline"])
for (d in seq_along(dts)) {
cat(.blue(dts[d]), ": ", sep="")
ind <- with(dd, Deadline == dts[d])
blk <- dd[ind, ]
pv <- paste0(.purple(blk[,1]), " (", blk[,2], ")")
cat(paste(strwrap(paste(pv, collapse=", "), 200), "\n"))
}

0 comments on commit 4325b43

Please sign in to comment.