Skip to content
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

DS-5106: Merge upstream changes from r-lib/cli #2

Merged
merged 84 commits into from Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
dd342c4
Fix docs: remove duplicated item
davidchall Oct 23, 2022
5e317c2
Merge pull request #535 from davidchall/patch-1
gaborcsardi Oct 23, 2022
0da3266
Fix typos
salim-b Oct 25, 2022
d0a7186
Fix another typo
salim-b Oct 25, 2022
7bfd35f
Merge pull request #536 from salim-b/patch-1
gaborcsardi Oct 26, 2022
a8e2d0e
Fix typo
salim-b Oct 26, 2022
4abe190
Merge pull request #537 from salim-b/patch-1
gaborcsardi Oct 26, 2022
58c2b97
Add UTF-8 snapshot output
gaborcsardi Nov 2, 2022
9dde594
document()
gaborcsardi Nov 3, 2022
300795b
Update GHA
gaborcsardi Nov 3, 2022
96d4c9e
New keypress() function (#540)
gaborcsardi Nov 4, 2022
5454fcb
New `hash_file_md5()` function, MD5 hash of files
gaborcsardi Nov 9, 2022
30e12dc
No show-cursor ANSI seq in task cb & finalizer if env var
gaborcsardi Nov 13, 2022
18d9f82
Compatibility with webR
georgestagg Nov 15, 2022
fa90b06
Support hidden visibility
lionel- Nov 17, 2022
30d0808
Merge pull request #543 from lionel-/webr-compat
gaborcsardi Nov 18, 2022
7e0cfa8
README in light/dark mode (#546)
gaborcsardi Dec 3, 2022
c61e538
add prettyunits to `Config/Needs/website` (#549)
simonpcouch Dec 16, 2022
5b1eecb
Polish NEWS
gaborcsardi Dec 20, 2022
28b7a8f
Fix URL redirect
gaborcsardi Dec 20, 2022
2f023b2
Increment version number to 3.5.0
gaborcsardi Dec 20, 2022
449d245
Increment version number to 3.5.0.9000
gaborcsardi Dec 20, 2022
8b0ce74
Fix doc (#552)
salim-b Dec 20, 2022
e792797
hash_*sha1() functions to calculate SHA-1 hashes (#551)
gaborcsardi Dec 21, 2022
bc50350
Set empty param-lists to `void` in exported `progress.h` file (#553)
lionel- Dec 21, 2022
8638a58
The progressr progress handler now reports progress correctly
gaborcsardi Jan 7, 2023
c317cee
Refine progress bar condition
gaborcsardi Jan 7, 2023
9379261
format_inline() now keeps newline charaters
gaborcsardi Jan 6, 2023
9ad08f4
New `keep_newlines = TRUE` argument to `format_inline()`
gaborcsardi Jan 7, 2023
542dc86
Add test cases for `format_inline(..., keep_newlines)`
gaborcsardi Jan 7, 2023
3de7ad6
Merge pull request #561 from r-lib/fix/format-inline-keep-newline
gaborcsardi Jan 7, 2023
7eb58fe
Add more (void) args to pacify CRAN's compilers
gaborcsardi Jan 9, 2023
a7c63c2
`format_inline()` now keeps all whitespace as is by default
gaborcsardi Jan 9, 2023
4cc6312
Increment version number to 3.6.0
gaborcsardi Jan 9, 2023
4303664
Increment version number to 3.6.0.9000
gaborcsardi Jan 9, 2023
01f932a
Fix ASAN warnings
gaborcsardi Jan 10, 2023
cd71ab4
Fix/tweak documentation
salim-b Feb 9, 2023
d5632e6
Update errors.R from processx
gaborcsardi Feb 22, 2023
c66419c
Manual: link to [inline-markup] where appropriate
gaborcsardi Feb 22, 2023
a740a2a
Fix hyperlink support detection in RStudio
gaborcsardi Mar 1, 2023
4578202
Turn off hyperlinks in the RStudio render pane
gaborcsardi Mar 1, 2023
aba4917
Remove test case that is not needed any more
gaborcsardi Mar 1, 2023
42991b5
Turn off ANSI hyperlinks if we don't have ANSI colors
gaborcsardi Mar 1, 2023
7911944
Fix test cases for hyperlink detection changes
gaborcsardi Mar 1, 2023
35d1027
Update NEWS
gaborcsardi Mar 22, 2023
c923764
Fix snapshots
gaborcsardi Mar 22, 2023
2f57dc1
Increment version number to 3.6.1
gaborcsardi Mar 22, 2023
1b60151
'lengths' instead of 'length'
jennybc Mar 22, 2023
8d8a211
Merge pull request #592 from r-lib/fix-partial-match
gaborcsardi Mar 23, 2023
b4f0cef
Document `str` in the class list
DavisVaughan Mar 24, 2023
df9517a
Mention `encodeString()`
DavisVaughan Mar 24, 2023
0b3de0f
Merge pull request #593 from r-lib/feature/document-str
gaborcsardi Mar 24, 2023
5ca2ba9
Merge remote-tracking branch 'origin/main'
gaborcsardi Mar 26, 2023
e1d9728
Increment version number to 3.6.1.9000
gaborcsardi Mar 26, 2023
c37f34b
Fix pkgdown build on CI
gaborcsardi Apr 7, 2023
6316614
Fix typo in "directory"
bairdj May 12, 2023
b7cfd5e
Merge pull request #600 from bairdj/directory-typo
gaborcsardi May 12, 2023
94906ff
Tyoi
olivroy May 15, 2023
778f7d0
Merge pull request #602 from olivroy/patch-1
gaborcsardi May 15, 2023
288862e
Add R-hub v2 workflow file
gaborcsardi May 25, 2023
9711564
Fixed typo
Shians Jun 2, 2023
fadd61d
Merge pull request #609 from Shians/main
gaborcsardi Jun 2, 2023
b0752db
Fix minor typo in hash_raw_animal docs
justin-mills-fws Jun 15, 2023
74fd22a
Fixed typo in hash_animal() docs
justin-mills-fws Jun 15, 2023
2a896ac
Update hash.R
justin-mills-fws Jun 15, 2023
17c3bc3
Fixed a few typos in hash_md5() docs
justin-mills-fws Jun 15, 2023
dc095a3
Replaced between to remove ambiguitity about whether range is inclusive
justin-mills-fws Jun 15, 2023
7b3d42a
Update hash.R
justin-mills-fws Jun 15, 2023
7eb56eb
Merge pull request #611 from justin-mills-fws/main
gaborcsardi Jun 15, 2023
723310c
Add missing c() in cli_abort()
Jul 22, 2023
a09635d
Merge pull request #622 from ynsec37/fix/usethis-ui
gaborcsardi Jul 22, 2023
3b43a3a
Move scripts to /exec
gaborcsardi Jul 25, 2023
525ebbe
Fix URLs in news.R script
gaborcsardi Jul 25, 2023
88cc280
Fix typo
salim-b Jul 29, 2023
37781c4
Merge branch 'main' into patch-1
gaborcsardi Jul 31, 2023
8c0a784
Merge pull request #582 from salim-b/patch-1
gaborcsardi Jul 31, 2023
744bc27
Redocument
gaborcsardi Aug 18, 2023
cb09f2a
Change semantics of cli.default_num_colors option
gaborcsardi Aug 18, 2023
6d458bb
Document
gaborcsardi Aug 18, 2023
30d24dc
Merge pull request #625 from r-lib/fix/default-num-colors
gaborcsardi Aug 18, 2023
c36066c
Docs typo
gaborcsardi Aug 18, 2023
a9fc76b
Merge remote-tracking branch 'fork/main' into DS-5106
mwmclean Aug 22, 2023
d619ed4
DS-5106: Rerun GitHub Action
mwmclean Aug 24, 2023
60957b2
Trigger tests
Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/workflows/R-CMD-check.yaml
Expand Up @@ -22,27 +22,27 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}

- {os: windows-2022, r: 'devel'}
- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel-1'}
- {os: ubuntu-18.04, r: 'oldrel-2'}
- {os: ubuntu-18.04, r: 'oldrel-3'}
- {os: ubuntu-18.04, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -56,7 +56,6 @@ jobs:
with:
extra-packages: any::rcmdcheck
needs: check
pak-version: rc

- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pkgdown.yaml
Expand Up @@ -21,7 +21,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_CLI_NUM_COLORS: 256
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -36,7 +36,6 @@ jobs:
local::.
local::./tests/testthat/progresstest
needs: website
pak-version: rc

- name: Build site
run: |
Expand All @@ -48,7 +47,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pr-commands.yaml
Expand Up @@ -14,7 +14,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/pr-fetch@v2
with:
Expand All @@ -28,7 +28,6 @@ jobs:
with:
extra-packages: any::roxygen2
needs: pr-document
pak-version: rc

- name: Document
run: roxygen2::roxygenise()
Expand All @@ -52,7 +51,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/rhub.yaml
@@ -0,0 +1,72 @@
# R-hub's genetic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/rhub2/blob/v1/inst/workflow/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub2::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/rhub2/actions/rhub-setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: actions/checkout@v3
- uses: r-hub/rhub2/actions/rhub-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: actions/checkout@v3
- uses: r-hub/rhub2/actions/rhub-setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/rhub2/actions/rhub-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
24 changes: 21 additions & 3 deletions .github/workflows/test-coverage.yaml
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -25,8 +25,26 @@ jobs:
with:
extra-packages: any::covr
needs: coverage
pak-version: rc

- name: Test coverage
run: covr::codecov(quiet = FALSE)
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
5 changes: 3 additions & 2 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: cli
Title: Helpers for Developing Command Line Interfaces
Version: 3.4.1.9000
Version: 3.6.1.9000
Authors@R: c(
person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")),
person("Hadley", "Wickham", role = "ctb"),
Expand Down Expand Up @@ -50,10 +50,11 @@ Config/Needs/website:
decor,
desc,
fansi,
prettyunits,
sessioninfo,
tidyverse/tidytemplate,
usethis,
vctrs
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.1.9000
RoxygenNote: 7.2.3
7 changes: 7 additions & 0 deletions NAMESPACE
Expand Up @@ -166,22 +166,29 @@ export(format_inline)
export(format_message)
export(format_warning)
export(get_spinner)
export(has_keypress_support)
export(hash_animal)
export(hash_emoji)
export(hash_file_md5)
export(hash_file_sha1)
export(hash_file_sha256)
export(hash_md5)
export(hash_obj_animal)
export(hash_obj_emoji)
export(hash_obj_md5)
export(hash_obj_sha1)
export(hash_obj_sha256)
export(hash_raw_animal)
export(hash_raw_emoji)
export(hash_raw_md5)
export(hash_raw_sha1)
export(hash_raw_sha256)
export(hash_sha1)
export(hash_sha256)
export(is_ansi_tty)
export(is_dynamic_tty)
export(is_utf8_output)
export(keypress)
export(list_border_styles)
export(list_spinners)
export(list_symbols)
Expand Down
27 changes: 27 additions & 0 deletions NEWS.md
@@ -1,5 +1,29 @@
# cli (development version)

# cli 3.6.1

* ANSI hyperlinks are now turned off on the RStudio render plane (#581).

# cli 3.6.0

* The progressr progress handler now reports progress correctly
(@HenrikBengtsson, #558).

* New `hash_*sha1()` functions to calculate the SHA-1 hash of strings,
objects, files.

* cli now shows progress bars after one second by default, if they
are less than half way at the point. (Or after two seconds,
unconditionally, as before.) See the the `cli.progress_show_after`
option in `?cli-config` for details (#542).

* `format_inline()` now has a new argument `keep_whitespace`, and it keeps
whitespace, including newline and form feed characters by default.

# cli 3.5.0

* New `keypress()` function to read a single key press from a terminal.

* New function `pretty_print_code()` to print function objects with syntax
highlighting at the R console.

Expand All @@ -11,6 +35,9 @@
* `ansi_strtrim()` now handles some edge cases better, when `ellipsis` has
length zero, and when it is wider than `width`.

* New `hash_file_md5()` function to calculate the MD5 hash of one or more
files.

# cli 3.4.1

* cli has better error messages now.
Expand Down
21 changes: 14 additions & 7 deletions R/aab-rstudio-detect.R
Expand Up @@ -209,7 +209,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = FALSE,
num_colors = 1L,
hyperlink = FALSE
hyperlink = FALSE,
has_canonical_mode = FALSE
)
}

Expand All @@ -220,7 +221,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = data$envs[["RSTUDIO_CONSOLE_COLOR"]] != "",
num_colors = as.integer(data$envs[["RSTUDIO_CONSOLE_COLOR"]]),
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != ""
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != "",
has_canonical_mode = FALSE
)
}

Expand All @@ -237,7 +239,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = FALSE,
num_colors = 1L,
hyperlink = FALSE
hyperlink = FALSE,
has_canonical_mode = FALSE
)
}

Expand All @@ -248,7 +251,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = data$envs[["RSTUDIO_CONSOLE_COLOR"]] != "",
num_colors = as.integer(data$envs[["RSTUDIO_CONSOLE_COLOR"]]),
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != ""
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != "",
has_canonical_mode = FALSE
)
}

Expand All @@ -259,7 +263,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = data$envs[["RSTUDIO_CONSOLE_COLOR"]] != "",
num_colors = as.integer(data$envs[["RSTUDIO_CONSOLE_COLOR"]]),
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != ""
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != "",
has_canonical_mode = FALSE
)
}

Expand All @@ -270,7 +275,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = FALSE,
num_colors = 1L,
hyperlink = data$envs[["RSTUDIO_CLI_HYPERLINKS"]] != ""
hyperlink = FALSE,
has_canonical_mode = FALSE
)
}

Expand All @@ -281,7 +287,8 @@ rstudio <- local({
ansi_tty = FALSE,
ansi_color = FALSE,
num_colors = 1L,
hyperlink = FALSE
hyperlink = FALSE,
has_canonical_mode = FALSE
)
}

Expand Down
12 changes: 1 addition & 11 deletions R/ansi-hyperlink.R
Expand Up @@ -327,17 +327,7 @@ ansi_has_hyperlink_support <- function() {
if (isTRUE(as.logical(enabled))){ return(TRUE) }

## If ANSI support is off, then this is off as well
opt <- as.integer(getOption("cli.num_colors", NULL))[1]
if (!is.na(opt) && opt == 1) return(FALSE)
env <- as.integer(Sys.getenv("R_CLI_NUM_COLORS", ""))[1]
if (!is.na(env) && env == 1) return(FALSE)
cray_opt <- as.logical(getOption("crayon.enabled", NULL))[1]
if (!is.na(cray_opt) && !cray_opt) return(FALSE)
if (!is.na(Sys.getenv("NO_COLOR", NA_character_))) return(FALSE)

## environment variable used by RStudio
enabled <- Sys.getenv("RSTUDIO_CLI_HYPERLINKS", "")
if (isTRUE(as.logical(enabled))){ return(TRUE) }
if (num_ansi_colors() == 1) return(FALSE)

## Are we in RStudio?
rstudio <- rstudio_detect()
Expand Down