link text for files does not display properly with `fs_path` objects

Open
#714 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
cli

Research direction

Start by reproducing the two R examples using fs::path and cli::cli_text, comparing interpolation with the fs_path object and with unclass(path). The issue names no files or tests; done means the rendered link shows text c while retaining the file://a/b target for fs_path input.

Written by the indexing model from the issue text.

Description

bug

If I pass output from {fs} into link text, the actual link still shows up in the output:

path <- fs::path("a/b")
# with fs_path object
cli::cli_text("go to {.href [c](file://{path})}")
#> go to a/bc
#
# with character
cli::cli_text("go to {.href [c](file://{unclass(path)})}")
#> go to c

FWIW, this is what the output of reprex looks like:

path <- fs::path("a/b")
# with fs_path object
cli::cli_text("go to {.href [c](file://{path})}")
#> go to c (<file://'a/b'>)
cli::cli_text("go to {.href [c](file://{unclass(path)})}")
#
# with character
#> go to c (<file://a/b>)

Created on 2024-08-09 with reprex v2.1.1

Dominant language
R
Stars
726
Forks
94
Avg merge
3h 35m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/cli

All issues in r-lib/cli

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.