-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cli #1956
Merged
Use cli #1956
Changes from all commits
Commits
Show all changes
111 commits
Select commit
Hold shift + click to select a range
1dc845c
Init article on the conversion task
jennybc f7b906a
Build up the cli-based UI in one place
jennybc 2194623
Introduce ui_cli_bullets()
jennybc 26f1d31
author.R
jennybc 7c96412
Factor out the path-processing logic into ui_path_impl()
jennybc 1a63223
addin.R
jennybc de288ca
ui_bullets() is better because shorter
jennybc 1db32b4
badge.R
jennybc 4ab8df7
ui_abort() feels more consistent with everything else
jennybc 5827019
Introduce ui_code_snippet()
jennybc fa943c2
block.R
jennybc d4b4009
Some testing improvements
jennybc c8b7c62
Test ui_code_snippet()
jennybc 2fb1a4c
Replace all calls to ui_code_block()
jennybc 5377788
Typo
jennybc 4251e5c
Update conversion article
jennybc 8a7a250
browse.R
jennybc 46a9f22
Eliminate usage of ui_warn()
jennybc 87783e8
ci.R
jennybc d500a8f
code_of_conduct.R
jennybc da160a9
course.R
jennybc cd7e298
coverage.R
jennybc fb2e179
cpp11.R
jennybc c9ef28c
Single quote inline .field if no color
jennybc 681ad46
create.R
jennybc 582d271
data.R
jennybc 8186323
description.R
jennybc bf88fde
directory.R
jennybc a468a4a
edit.R
jennybc 2530f03
git-default-branch.R
jennybc 73b986c
git.R
jennybc a64ecf4
Test bulletize() and usethis_map_cli()
jennybc bcb5f6b
github-actions.R
jennybc 8de285e
.val seems like a better default for usethis
jennybc 7e9aeb9
github-labels.R
jennybc 776b4a0
github-pages.R
jennybc bd730c1
github.R + check_current_branch()
jennybc 2e97e4f
github_token.R
jennybc ab2120d
Remove hd_line() which is not used anywhere at this point
jennybc 0ece8f4
Notes
jennybc e6d365c
Modernize kv_line() + other changes to improve git_sitrep()
jennybc e1b2d97
github_token.R
jennybc 5e44d17
helpers.R
jennybc bfd87d7
issue.R
jennybc 142c1fa
license.R
jennybc 48346b0
lifecycle.R
jennybc c85f779
logo.R
jennybc 0e8252c
news.R
jennybc 55f0819
package.R
jennybc 1e3f5c8
pkgdown.R
jennybc bba1926
Provide default bullets in ui_abort()
jennybc 89b8a1b
pr.R
jennybc 6467992
proj-desc.R
jennybc cb51d5f
proj.R
jennybc dd3d14f
rcpp.R
jennybc b0fe620
readme.R
jennybc 8c89ffe
release.R
jennybc 42bfc88
rename-files.R
jennybc 9f5d79b
revdep.R
jennybc ae18ced
roxygen.R
jennybc 5075412
rprofile.R
jennybc 83161d7
rstudio.R
jennybc 4eab6d4
sitrep.R
jennybc 747629c
spelling.R
jennybc 4b40d27
template.R
jennybc 1b5a8d0
test.R
jennybc d7c2a89
tibble.R
jennybc a1f1d0e
tidyverse.R
jennybc 4bd21a1
upkeep.R
jennybc b9311c1
use_github_file.R
jennybc a6d8e97
use_import_fun.R
jennybc 8b0ccad
usethis-defunct.R
jennybc fd254f8
Rename to ui_legacy_bullet(); catch up on note-taking
jennybc c1f5d48
utils-git.R
jennybc 7cb0602
utils.R
jennybc 5f80d3a
version.R
jennybc a9ae363
vignette.R
jennybc 42b7c28
write.R
jennybc 8e390e7
utils-github.R
jennybc 043e8cf
Add snapshot tests for remote GitHub configurations
jennybc 667c148
Finish converting UI around GitHub remote configurations
jennybc f7f5ee0
Refactor flaky test
jennybc 25dcfdc
Better organization
jennybc f5b380d
Catch up on note-taking
jennybc de7e066
Work on making the article actually render the way I want
jennybc 86b3278
Mark ui_*() functions as superseded
jennybc 6333976
Mark ui_yeah() and ui_no() as superseded
jennybc e0df61c
Work on kv_line()
jennybc 397e0ac
Use ui_yep() and ui_nah() everywhere
jennybc c71ed6b
Re-align filenames re: legacy ui
jennybc 4653e81
OMG I don't want people to depend on usethis for ui functions
jennybc 7f99c38
Switch to ui_nah() , for real
jennybc cb91031
Make sure I don't call into the legacy file
jennybc 2aaa255
Deal with stragglers that are not TODOs
jennybc b25065c
Update principles.md
jennybc d0cc81e
NEWS bullet
jennybc a3ab22b
Yet another straggler
jennybc b2805d2
Deal with utils::menu() prep and other unusual stuff
jennybc c462abf
Make test less sensitive to local conditions
jennybc 12ee388
Article needs asciicast
jennybc c1c9297
Increase width to forcibly prevent snapshot diff due to linebreaks
jennybc db3c536
Organize the articles
jennybc 9143717
Update README
jennybc d7b30f7
Make the width even larger???
jennybc 226c4a0
Apply suggestions from code review
jennybc 4cea077
Update snapshot
jennybc 0baf2b5
How about cli.width?????
jennybc 3e343a3
YOLO
jennybc 210905f
`.run` fixups
jennybc 56c130c
These run afoul of the `.run` rules, so why bother
jennybc d6a3552
Better captures the intent
jennybc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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 |
---|---|---|
|
@@ -60,13 +60,15 @@ use_author <- function(given = NULL, family = NULL, ..., role = "ctb") { | |
author <- utils::person(given = given, family = family, role = role, ...) | ||
aut_fmt <- format(author, style = 'text') | ||
if (authors_at_r_already) { | ||
ui_done(" | ||
Adding to {ui_field('Authors@R')} in DESCRIPTION: | ||
{aut_fmt}") | ||
ui_bullets(c( | ||
"v" = "Adding to {.field Authors@R} in DESCRIPTION:", | ||
" " = "{aut_fmt}" | ||
)) | ||
} else { | ||
ui_done(" | ||
Creating {ui_field('Authors@R')} field in DESCRIPTION and adding: | ||
{aut_fmt}") | ||
ui_bullets(c( | ||
"v" = "Creating {.field Authors@R} field in DESCRIPTION and adding:", | ||
" " = "{aut_fmt}" | ||
)) | ||
} | ||
d$add_author(given = given, family = family, role = role, ...) | ||
|
||
|
@@ -84,17 +86,17 @@ challenge_legacy_author_fields <- function(d = proj_desc()) { | |
return(invisible()) | ||
} | ||
|
||
ui_oops(" | ||
Found legacy {ui_field('Author')} and/or {ui_field('Maintainer')} field \\ | ||
in DESCRIPTION. | ||
usethis only supports modification of the {ui_field('Authors@R')} field.") | ||
ui_info(" | ||
We recommend one of these paths forward: | ||
* Delete these fields and rebuild with {ui_code('use_author()')}. | ||
* Convert to {ui_field('Authors@R')} with {ui_code('desc::desc_coerce_authors_at_r()')}, | ||
then delete the legacy fields.") | ||
if (ui_yeah("Do you want to cancel this operation and sort that out first?")) { | ||
ui_stop("Cancelling.") | ||
ui_bullets(c( | ||
"x" = "Found legacy {.field Author} and/or {.field Maintainer} field in | ||
DESCRIPTION.", | ||
" " = "usethis only supports modification of the {.field Authors@R} field.", | ||
"i" = "We recommend one of these paths forward:", | ||
"_" = "Delete the legacy fields and rebuild with {.fun use_author}; or", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I introduce a new bullet type with shortcode |
||
"_" = "Convert to {.field Authors@R} with | ||
{.fun desc::desc_coerce_authors_at_r}, then delete the legacy fields." | ||
)) | ||
if (ui_yep("Do you want to cancel this operation and sort that out first?")) { | ||
ui_abort("Cancelling.") | ||
} | ||
invisible() | ||
} | ||
|
@@ -108,10 +110,10 @@ check_author_is_novel <- function(given = NULL, family = NULL, d = proj_desc()) | |
}) | ||
if (any(m)) { | ||
aut_name <- glue("{given %||% ''} {family %||% ''}") | ||
usethis_abort(c( | ||
"{.val {aut_name}} already appears in {.val Authors@R}.", | ||
"Please make the desired change directly in DESCRIPTION or call the \\ | ||
desc package directly." | ||
ui_abort(c( | ||
"x" = "{.val {aut_name}} already appears in {.field Authors@R}.", | ||
" " = "Please make the desired change directly in DESCRIPTION or call the | ||
{.pkg desc} package directly." | ||
)) | ||
} | ||
invisible() | ||
|
@@ -129,10 +131,11 @@ challenge_default_author <- function(d = proj_desc()) { | |
) | ||
|
||
if (any(m)) { | ||
ui_info(" | ||
{ui_field('Authors@R')} appears to include a placeholder author: | ||
{format(default_author, style = 'text')}") | ||
if(is_interactive() && ui_yeah("Would you like to remove it?")) { | ||
ui_bullets(c( | ||
"i" = "{.field Authors@R} appears to include a placeholder author:", | ||
" " = "{format(default_author, style = 'text')}" | ||
)) | ||
if(is_interactive() && ui_yep("Would you like to remove it?")) { | ||
# TODO: Do I want to suppress this output? | ||
# Authors removed: First Last, NULL NULL. | ||
do.call(d$del_author, unclass(default_author)[[1]]) | ||
|
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ui_bullets()
is a new unexported wrapper aroundcli::cli_bullets()
that applies a custom usethis style and honors theusethis.quiet
option. All of the old "block styles" get replaced byui_bullets()
.{.path {pth(addin_dcf_path)}}
is a clunky but effective pattern you will see a lot of. This is explained more fully in the article.pth()
is an internal helper that forms paths relative to a base and it's super important in usethis. But I also really, really want cli's file hyperlinks. I don't see a way to create a custom inline span that allows me to combine my pre-processsing with cli's file hyperlink support. But I'd love to learn that I'm wrong.