Skip to content

Commit

Permalink
Reformmated startup message
Browse files Browse the repository at this point in the history
The startup message now includes a link to the release notes.
  • Loading branch information
serkor1 committed Jan 8, 2024
1 parent 873413f commit b6a4b99
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 69 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Suggests:
tidyverse
Config/testthat/edition: 3
Imports:
cli,
curl (>= 5.1.0),
httr2,
lifecycle,
Expand Down
39 changes: 10 additions & 29 deletions R/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,41 +311,22 @@ startup_message <- function(
pkgversion
) {

# 1) get github release
# using rvest
#
# NOTE: This is risky in case
# urls changes. Outcommented until a
# better solution to display deevelopment + cran version
# in startuå
# github_release <- rvest::html_text(
# rvest::html_element(
# css = 'small',
# rvest::html_element(
# css = 'div',
# rvest::html_element(
# css = 'nav',
# rvest::read_html(
# x = 'https://serkor1.github.io/cryptoQuotes/index.html'
# )
# )
# )
# )
# )

# 2) Generate CLI
# formatted messages
c(
paste('Loading', pkgname),
'i' = paste('CRAN version:', pkgversion),
# 'i' = paste('Development version:', github_release),
'*' = paste('Release notes:', "https://serkor1.github.io/cryptoQuotes/news/index.html")
cli::rule(
left = paste(pkgname, cli::col_br_blue(pkgversion)),
right = cli::style_hyperlink(
text = paste(
cli::col_br_blue('release notes')
),
url = 'https://serkor1.github.io/cryptoQuotes/news/index.html'

)
)



}


# validators; ####
date_validator <- function(
from,
Expand Down
19 changes: 15 additions & 4 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,32 @@
# objective:
# script start;

.onAttach <- function(libname, pkgname) {
.onAttach <- function(libname, pkgname,...) {

# 1) startup message with
# using cli::rule
msg <- startup_message(
pkgname = pkgname,
pkgversion = utils::packageVersion(
pkgname
)
)

rlang::inform(
msg,
class = "packageStartupMessage"

rlang::inform(
msg
,
...,
class = "packageStartupMessage"
)








}

# script end;
Expand Down
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,122 +193,122 @@ Volume
<tbody>
<tr>
<td style="text-align:left;">
2024-01-08 02:30:00
2024-01-08 11:30:00
</td>
<td style="text-align:center;">
43636.94
44196.7
</td>
<td style="text-align:center;">
43668.14
44688
</td>
<td style="text-align:center;">
43175
44154.28
</td>
<td style="text-align:center;">
43371.09
44635.99
</td>
<td style="text-align:left;">
1740.05517
2259.56815
</td>
</tr>
<tr>
<td style="text-align:left;">
2024-01-08 03:00:00
2024-01-08 12:00:00
</td>
<td style="text-align:center;">
43371.09
44636
</td>
<td style="text-align:center;">
43442.42
45200
</td>
<td style="text-align:center;">
43225
44350
</td>
<td style="text-align:center;">
43277.82
44518.16
</td>
<td style="text-align:left;">
1138.00533
5567.92331
</td>
</tr>
<tr>
<td style="text-align:left;">
2024-01-08 03:30:00
2024-01-08 12:30:00
</td>
<td style="text-align:center;">
43277.83
44518.15
</td>
<td style="text-align:center;">
43568.85
45120.05
</td>
<td style="text-align:center;">
43257.29
44518.15
</td>
<td style="text-align:center;">
43518.2
45111.09
</td>
<td style="text-align:left;">
984.91972
1949.63739
</td>
</tr>
<tr>
<td style="text-align:left;">
2024-01-08 04:00:00
2024-01-08 13:00:00
</td>
<td style="text-align:center;">
43518.2
45111.1
</td>
<td style="text-align:center;">
43598
45179.14
</td>
<td style="text-align:center;">
43430.79
44948.83
</td>
<td style="text-align:center;">
43530.33
45098
</td>
<td style="text-align:left;">
591.54225
1995.89183
</td>
</tr>
<tr>
<td style="text-align:left;">
2024-01-08 04:30:00
2024-01-08 13:30:00
</td>
<td style="text-align:center;">
43530.34
45098
</td>
<td style="text-align:center;">
43610.68
45108.38
</td>
<td style="text-align:center;">
43500
44807.56
</td>
<td style="text-align:center;">
43599.26
44911.58
</td>
<td style="text-align:left;">
523.47388
1327.42193
</td>
</tr>
<tr>
<td style="text-align:left;">
2024-01-08 05:00:00
2024-01-08 14:00:00
</td>
<td style="text-align:center;">
43599.26
44911.58
</td>
<td style="text-align:center;">
43599.27
45031.31
</td>
<td style="text-align:center;">
43590.62
44832
</td>
<td style="text-align:center;">
43590.62
45002.78
</td>
<td style="text-align:left;">
2.06449
871.80155
</td>
</tr>
</tbody>
Expand Down

0 comments on commit b6a4b99

Please sign in to comment.