├── .Rbuildignore ├── .github ├── .gitignore ├── CODE_OF_CONDUCT.md └── workflows │ ├── R-CMD-check.yaml │ ├── pkgdown.yaml │ ├── pr-commands.yaml │ └── test-coverage.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── Makefile ├── NAMESPACE ├── NEWS.md ├── R ├── clisymbols-package.R └── symbols.R ├── README.Rmd ├── README.md ├── codecov.yml ├── man ├── clisymbols-package.Rd └── symbol.Rd ├── screenshot.png └── tests ├── testthat.R └── testthat └── test-all.R /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^tags$ 2 | ^README.Rmd$ 3 | ^Makefile$ 4 | ^.travis.yml$ 5 | ^appveyor.yml$ 6 | ^\.github$ 7 | ^LICENSE\.md$ 8 | ^codecov\.yml$ 9 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at codeofconduct@posit.co. 63 | All complaints will be reviewed and investigated promptly and fairly. 64 | 65 | All community leaders are obligated to respect the privacy and security of the 66 | reporter of any incident. 67 | 68 | ## Enforcement Guidelines 69 | 70 | Community leaders will follow these Community Impact Guidelines in determining 71 | the consequences for any action they deem in violation of this Code of Conduct: 72 | 73 | ### 1. Correction 74 | 75 | **Community Impact**: Use of inappropriate language or other behavior deemed 76 | unprofessional or unwelcome in the community. 77 | 78 | **Consequence**: A private, written warning from community leaders, providing 79 | clarity around the nature of the violation and an explanation of why the 80 | behavior was inappropriate. A public apology may be requested. 81 | 82 | ### 2. Warning 83 | 84 | **Community Impact**: A violation through a single incident or series of 85 | actions. 86 | 87 | **Consequence**: A warning with consequences for continued behavior. No 88 | interaction with the people involved, including unsolicited interaction with 89 | those enforcing the Code of Conduct, for a specified period of time. This 90 | includes avoiding interactions in community spaces as well as external channels 91 | like social media. Violating these terms may lead to a temporary or permanent 92 | ban. 93 | 94 | ### 3. Temporary Ban 95 | 96 | **Community Impact**: A serious violation of community standards, including 97 | sustained inappropriate behavior. 98 | 99 | **Consequence**: A temporary ban from any sort of interaction or public 100 | communication with the community for a specified period of time. No public or 101 | private interaction with the people involved, including unsolicited interaction 102 | with those enforcing the Code of Conduct, is allowed during this period. 103 | Violating these terms may lead to a permanent ban. 104 | 105 | ### 4. Permanent Ban 106 | 107 | **Community Impact**: Demonstrating a pattern of violation of community 108 | standards, including sustained inappropriate behavior, harassment of an 109 | individual, or aggression toward or disparagement of classes of individuals. 110 | 111 | **Consequence**: A permanent ban from any sort of public interaction within the 112 | community. 113 | 114 | ## Attribution 115 | 116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 117 | version 2.1, available at 118 | . 119 | 120 | Community Impact Guidelines were inspired by 121 | [Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion]. 122 | 123 | For answers to common questions about this code of conduct, see the FAQ at 124 | . Translations are available at . 125 | 126 | [homepage]: https://www.contributor-covenant.org 127 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | # 4 | # NOTE: This workflow is overkill for most R packages and 5 | # check-standard.yaml is likely a better choice. 6 | # usethis::use_github_action("check-standard") will install it. 7 | on: 8 | push: 9 | branches: [main, master] 10 | pull_request: 11 | 12 | name: R-CMD-check.yaml 13 | 14 | permissions: read-all 15 | 16 | jobs: 17 | R-CMD-check: 18 | runs-on: ${{ matrix.config.os }} 19 | 20 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | config: 26 | - {os: macos-latest, r: 'release'} 27 | 28 | - {os: windows-latest, r: 'release'} 29 | # use 4.0 or 4.1 to check with rtools40's older compiler 30 | - {os: windows-latest, r: 'oldrel-4'} 31 | 32 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 33 | - {os: ubuntu-latest, r: 'release'} 34 | - {os: ubuntu-latest, r: 'oldrel-1'} 35 | - {os: ubuntu-latest, r: 'oldrel-2'} 36 | - {os: ubuntu-latest, r: 'oldrel-3'} 37 | - {os: ubuntu-latest, r: 'oldrel-4'} 38 | 39 | env: 40 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 41 | R_KEEP_PKG_SOURCE: yes 42 | 43 | steps: 44 | - uses: actions/checkout@v4 45 | 46 | - uses: r-lib/actions/setup-pandoc@v2 47 | 48 | - uses: r-lib/actions/setup-r@v2 49 | with: 50 | r-version: ${{ matrix.config.r }} 51 | http-user-agent: ${{ matrix.config.http-user-agent }} 52 | use-public-rspm: true 53 | 54 | - uses: r-lib/actions/setup-r-dependencies@v2 55 | with: 56 | extra-packages: any::rcmdcheck 57 | needs: check 58 | 59 | - uses: r-lib/actions/check-r-package@v2 60 | with: 61 | upload-snapshots: true 62 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 63 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | release: 8 | types: [published] 9 | workflow_dispatch: 10 | 11 | name: pkgdown.yaml 12 | 13 | permissions: read-all 14 | 15 | jobs: 16 | pkgdown: 17 | runs-on: ubuntu-latest 18 | # Only restrict concurrency for non-PR jobs 19 | concurrency: 20 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 21 | env: 22 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 23 | permissions: 24 | contents: write 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - uses: r-lib/actions/setup-pandoc@v2 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | use-public-rspm: true 33 | 34 | - uses: r-lib/actions/setup-r-dependencies@v2 35 | with: 36 | extra-packages: any::pkgdown, local::. 37 | needs: website 38 | 39 | - name: Build site 40 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 41 | shell: Rscript {0} 42 | 43 | - name: Deploy to GitHub pages 🚀 44 | if: github.event_name != 'pull_request' 45 | uses: JamesIves/github-pages-deploy-action@v4.5.0 46 | with: 47 | clean: false 48 | branch: gh-pages 49 | folder: docs 50 | -------------------------------------------------------------------------------- /.github/workflows/pr-commands.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | issue_comment: 5 | types: [created] 6 | 7 | name: pr-commands.yaml 8 | 9 | permissions: read-all 10 | 11 | jobs: 12 | document: 13 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} 14 | name: document 15 | runs-on: ubuntu-latest 16 | env: 17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 18 | permissions: 19 | contents: write 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - uses: r-lib/actions/pr-fetch@v2 24 | with: 25 | repo-token: ${{ secrets.GITHUB_TOKEN }} 26 | 27 | - uses: r-lib/actions/setup-r@v2 28 | with: 29 | use-public-rspm: true 30 | 31 | - uses: r-lib/actions/setup-r-dependencies@v2 32 | with: 33 | extra-packages: any::roxygen2 34 | needs: pr-document 35 | 36 | - name: Document 37 | run: roxygen2::roxygenise() 38 | shell: Rscript {0} 39 | 40 | - name: commit 41 | run: | 42 | git config --local user.name "$GITHUB_ACTOR" 43 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 44 | git add man/\* NAMESPACE 45 | git commit -m 'Document' 46 | 47 | - uses: r-lib/actions/pr-push@v2 48 | with: 49 | repo-token: ${{ secrets.GITHUB_TOKEN }} 50 | 51 | style: 52 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} 53 | name: style 54 | runs-on: ubuntu-latest 55 | env: 56 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 57 | permissions: 58 | contents: write 59 | steps: 60 | - uses: actions/checkout@v4 61 | 62 | - uses: r-lib/actions/pr-fetch@v2 63 | with: 64 | repo-token: ${{ secrets.GITHUB_TOKEN }} 65 | 66 | - uses: r-lib/actions/setup-r@v2 67 | 68 | - name: Install dependencies 69 | run: install.packages("styler") 70 | shell: Rscript {0} 71 | 72 | - name: Style 73 | run: styler::style_pkg() 74 | shell: Rscript {0} 75 | 76 | - name: commit 77 | run: | 78 | git config --local user.name "$GITHUB_ACTOR" 79 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 80 | git add \*.R 81 | git commit -m 'Style' 82 | 83 | - uses: r-lib/actions/pr-push@v2 84 | with: 85 | repo-token: ${{ secrets.GITHUB_TOKEN }} 86 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | 8 | name: test-coverage.yaml 9 | 10 | permissions: read-all 11 | 12 | jobs: 13 | test-coverage: 14 | runs-on: ubuntu-latest 15 | env: 16 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - uses: r-lib/actions/setup-r@v2 22 | with: 23 | use-public-rspm: true 24 | 25 | - uses: r-lib/actions/setup-r-dependencies@v2 26 | with: 27 | extra-packages: any::covr, any::xml2 28 | needs: coverage 29 | 30 | - name: Test coverage 31 | run: | 32 | cov <- covr::package_coverage( 33 | quiet = FALSE, 34 | clean = FALSE, 35 | install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") 36 | ) 37 | covr::to_cobertura(cov) 38 | shell: Rscript {0} 39 | 40 | - uses: codecov/codecov-action@v4 41 | with: 42 | # Fail if error if not on PR, or if on PR and token is given 43 | fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} 44 | file: ./cobertura.xml 45 | plugin: noop 46 | disable_search: true 47 | token: ${{ secrets.CODECOV_TOKEN }} 48 | 49 | - name: Show testthat output 50 | if: always() 51 | run: | 52 | ## -------------------------------------------------------------------- 53 | find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true 54 | shell: bash 55 | 56 | - name: Upload test results 57 | if: failure() 58 | uses: actions/upload-artifact@v4 59 | with: 60 | name: coverage-test-failures 61 | path: ${{ runner.temp }}/package 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | /tags 5 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: clisymbols 2 | Title: Unicode Symbols at the R Prompt 3 | Version: 1.2.0 4 | Authors@R: c( 5 | person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), 6 | person("Sindre", "Sorhus", role = "aut"), 7 | person("Posit Software, PBC", role = c("cph", "fnd")) 8 | ) 9 | Description: A small subset of Unicode symbols, that are useful when 10 | building command line applications. They fall back to alternatives on 11 | terminals that do not support Unicode. Many symbols were taken from 12 | the 'figures' 'npm' package (see 13 | ). 14 | License: MIT + file LICENSE 15 | URL: https://github.com/r-lib/clisymbols#readme 16 | BugReports: https://github.com/r-lib/clisymbols/issues 17 | Depends: 18 | R (>= 3.6) 19 | Suggests: 20 | testthat 21 | Encoding: UTF-8 22 | RoxygenNote: 7.2.3 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2023 2 | COPYRIGHT HOLDER: clisymbols authors 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2023 clisymbols authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | all: README.md 3 | 4 | README.md: README.Rmd 5 | Rscript -e "library(knitr); knit('$<', output = '$@', quiet = TRUE)" 6 | 7 | 8 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(symbol) 4 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | 2 | # 1.2.0 3 | 4 | * New symbol: `double_line`: ═ 5 | 6 | * New block symbols: `upper_block_1`: ▔, `upper_block_4`: ▀, 7 | `lower_block_1`: ▁, etc. `lower_block_8`: █ 8 | (`lower_block_8` is also known as `full_block`.) 9 | 10 | * Better detection of UTF-8 support: use the official `l10n_info()` 11 | function 12 | 13 | # 1.1.0 14 | 15 | Three more symbols: `neq`: ≠, `geq`: ≥, `leq`: ≤ 16 | 17 | # 1.0.0 18 | 19 | First released version. 20 | -------------------------------------------------------------------------------- /R/clisymbols-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | 4 | ## usethis namespace: start 5 | ## usethis namespace: end 6 | NULL 7 | -------------------------------------------------------------------------------- /R/symbols.R: -------------------------------------------------------------------------------- 1 | 2 | #' Various handy symbols to use in a command line UI 3 | #' 4 | #' @usage 5 | #' symbol 6 | #' 7 | #' @format A named list, see \code{names(symbol)} for all sign names. 8 | #' 9 | #' @details 10 | #' 11 | #' On Windows they have a fallback to less fancy symbols. 12 | #' 13 | #' @aliases symbol 14 | #' @export symbol 15 | #' 16 | #' @examples 17 | #' cat(symbol$tick, " SUCCESS\n", symbol$cross, " FAILURE\n", sep = "") 18 | #' 19 | #' ## All symbols 20 | #' cat(paste(format(names(symbol), width = 20), unlist(symbol)), sep = "\n") 21 | 22 | symbol <- list() 23 | 24 | symbol_utf8 <- list( 25 | "tick" = '\u2714', 26 | "cross" = '\u2716', 27 | "star" = '\u2605', 28 | "square" = '\u2587', 29 | "square_small" = '\u25FB', 30 | "square_small_filled" = '\u25FC', 31 | "circle" = '\u25EF', 32 | "circle_filled" = '\u25C9', 33 | "circle_dotted" = '\u25CC', 34 | "circle_double" = '\u25CE', 35 | "circle_circle" = '\u24DE', 36 | "circle_cross" = '\u24E7', 37 | "circle_pipe" = '\u24be', 38 | "circle_question_mark" = '?\u20DD', 39 | "bullet" = '\u25CF', 40 | "dot" = '\u2024', 41 | "line" = '\u2500', 42 | "double_line" = "\u2550", 43 | "ellipsis" = '\u2026', 44 | "pointer" = '\u276F', 45 | "info" = '\u2139', 46 | "warning" = '\u26A0', 47 | "menu" = '\u2630', 48 | "smiley" = '\u263A', 49 | "mustache" = '\u0DF4', 50 | "heart" = '\u2665', 51 | "arrow_up" = '\u2191', 52 | "arrow_down" = '\u2193', 53 | "arrow_left" = '\u2190', 54 | "arrow_right" = '\u2192', 55 | "radio_on" = '\u25C9', 56 | "radio_off" = '\u25EF', 57 | "checkbox_on" = '\u2612', 58 | "checkbox_off" = '\u2610', 59 | "checkbox_circle_on" = '\u24E7', 60 | "checkbox_circle_off" = '\u24BE', 61 | "fancy_question_mark" = '\u2753', 62 | "neq" = "\u2260", 63 | "geq" = "\u2265", 64 | "leq" = "\u2264", 65 | "times" = "\u00d7", 66 | 67 | "upper_block_1" = "\u2594", 68 | "upper_block_4" = "\u2580", 69 | 70 | "lower_block_1" = "\u2581", 71 | "lower_block_2" = "\u2582", 72 | "lower_block_3" = "\u2583", 73 | "lower_block_4" = "\u2584", 74 | "lower_block_5" = "\u2585", 75 | "lower_block_6" = "\u2586", 76 | "lower_block_7" = "\u2587", 77 | "lower_block_8" = "\u2588", 78 | 79 | "full_block" = "\u2588" 80 | ) 81 | 82 | symbol_win <- list( 83 | "tick" = '\u221A', 84 | "cross" = 'x', 85 | "star" = '*', 86 | "square" = '\u2588', 87 | "square_small" = '[ ]', 88 | "square_small_filled" = '[\u2588]', 89 | "circle" = '( )', 90 | "circle_filled" = '(*)', 91 | "circle_dotted" = '( )', 92 | "circle_double" = '(o)', 93 | "circle_circle" = '(o)', 94 | "circle_cross" = '(x)', 95 | "circle_pipe" = '(|)', 96 | "circle_question_mark" = '(?)', 97 | "bullet" = '*', 98 | "dot" = '.', 99 | "line" = '\u2500', 100 | "double_line" = "=", 101 | "ellipsis" = '...', 102 | "pointer" = '>', 103 | "info" = 'i', 104 | "warning" = '\u203C', 105 | "menu" = '\u2261', 106 | "smiley" = '\u263A', 107 | "mustache" = '\u250C\u2500\u2510', 108 | "heart" = '\u2665', 109 | "arrow_up" = '^', 110 | "arrow_down" = 'v', 111 | "arrow_left" = '<', 112 | "arrow_right" = '>', 113 | "radio_on" = '(*)', 114 | "radio_off" = '( )', 115 | "checkbox_on" = '[x]', 116 | "checkbox_off" = '[ ]', 117 | "checkbox_circle_on" = '(x)', 118 | "checkbox_circle_off" = '( )', 119 | "fancy_question_mark" = "(?)", 120 | "neq" = "!=", 121 | "geq" = ">=", 122 | "leq" = "<=", 123 | "times" = "x", 124 | 125 | "upper_block_1" = "^", 126 | "upper_block_4" = "^", 127 | 128 | "lower_block_1" = ".", 129 | "lower_block_2" = "_", 130 | "lower_block_3" = "_", 131 | "lower_block_4" = "=", 132 | "lower_block_5" = "=", 133 | "lower_block_6" = "*", 134 | "lower_block_7" = "\u2588", 135 | "lower_block_8" = "\u2588", 136 | 137 | "full_block" = "\u2588" 138 | ) 139 | 140 | symbol_win_rstudio <- list( 141 | "tick" = '\u2714', 142 | "cross" = '\u2716', 143 | "star" = '\u2605', 144 | "square" = '\u2587', 145 | "square_small" = '[ ]', 146 | "square_small_filled" = '[\u2588]', 147 | "circle" = '\u25EF', 148 | "circle_filled" = '(*)', 149 | "circle_dotted" = '\u25CC', 150 | "circle_double" = '(o)', 151 | "circle_circle" = '\u24DE', 152 | "circle_cross" = '\u24E7', 153 | "circle_pipe" = '\u24be', 154 | "circle_question_mark" = '(?)', 155 | "bullet" = '\u25CF', 156 | "dot" = '.', 157 | "line" = '\u2500', 158 | "double_line" = "\u2550", 159 | "ellipsis" = '\u2026', 160 | "pointer" = '>', 161 | "info" = 'i', 162 | "warning" = '\u203C', 163 | "menu" = '\u2630', 164 | "smiley" = '\u263A', 165 | "mustache" = '\u0DF4', 166 | "heart" = '\u2665', 167 | "arrow_up" = '\u2191', 168 | "arrow_down" = '\u2193', 169 | "arrow_left" = '\u2190', 170 | "arrow_right" = '\u2192', 171 | "radio_on" = '(*)', 172 | "radio_off" = '( )', 173 | "checkbox_on" = '\u2612', 174 | "checkbox_off" = '\u2610', 175 | "checkbox_circle_on" = '\u24E7', 176 | "checkbox_circle_off" = '\u24BE', 177 | "fancy_question_mark" = '(?)', 178 | "neq" = "!=", 179 | "geq" = ">=", 180 | "leq" = "<=", 181 | "times" = "\u00d7", 182 | 183 | "upper_block_1" = "\u2594", 184 | "upper_block_4" = "\u2580", 185 | 186 | "lower_block_1" = "\u2581", 187 | "lower_block_2" = "\u2582", 188 | "lower_block_3" = "\u2583", 189 | "lower_block_4" = "\u2584", 190 | "lower_block_5" = "\u2585", 191 | "lower_block_6" = "\u2586", 192 | "lower_block_7" = "\u2587", 193 | "lower_block_8" = "\u2588", 194 | 195 | "full_block" = "\u2588" 196 | ) 197 | 198 | symbol_win_rgui <- list( 199 | "tick" = '\u2714', 200 | "cross" = '\u2716', 201 | "star" = '\u2605', 202 | "square" = '\u2588', 203 | "square_small" = '[ ]', 204 | "square_small_filled" = '[\u2588]', 205 | "circle" = '\u25EF', 206 | "circle_filled" = '(*)', 207 | "circle_dotted" = '( )', 208 | "circle_double" = '(o)', 209 | "circle_circle" = '(o)', 210 | "circle_cross" = '(x)', 211 | "circle_pipe" = '(|)', 212 | "circle_question_mark" = '(?)', 213 | "bullet" = '\u25CF', 214 | "dot" = '.', 215 | "line" = '\u2500', 216 | "double_line" = "=", 217 | "ellipsis" = '\u2026', 218 | "pointer" = '>', 219 | "info" = 'i', 220 | "warning" = '\u203C', 221 | "menu" = '\u2630', 222 | "smiley" = '\u263A', 223 | "mustache" = '\u0DF4', 224 | "heart" = '\u2665', 225 | "arrow_up" = '\u2191', 226 | "arrow_down" = '\u2193', 227 | "arrow_left" = '\u2190', 228 | "arrow_right" = '\u2192', 229 | "radio_on" = '(*)', 230 | "radio_off" = '( )', 231 | "checkbox_on" = '[x]', 232 | "checkbox_off" = '[ ]', 233 | "checkbox_circle_on" = '(x)', 234 | "checkbox_circle_off" = '( )', 235 | "fancy_question_mark" = '(?)', 236 | "neq" = "!=", 237 | "geq" = ">=", 238 | "leq" = "<=", 239 | "times" = "\u00d7", 240 | 241 | "upper_block_1" = "^", 242 | "upper_block_4" = "\u2580", 243 | 244 | "lower_block_1" = ".", 245 | "lower_block_2" = "_", 246 | "lower_block_3" = "_", 247 | "lower_block_4" = "\u2584", 248 | "lower_block_5" = "=", 249 | "lower_block_6" = "*", 250 | "lower_block_7" = "#", 251 | "lower_block_8" = "\u2588", 252 | 253 | "full_block" = "\u2588" 254 | ) 255 | 256 | is_windows <- function() { 257 | .Platform$OS.type == "windows" 258 | } 259 | 260 | is_r_studio <- function() { 261 | Sys.getenv("RSTUDIO") == 1 262 | } 263 | 264 | is_rgui <- function() { 265 | .Platform$GUI[1] == "Rgui" 266 | } 267 | 268 | .onLoad <- function(libname, pkgname) { 269 | if (is_windows() && is_rgui()) { 270 | symbol <<- symbol_win_rgui 271 | } else if (is_windows() && is_r_studio()) { 272 | symbol <<- symbol_win_rstudio 273 | } else if (l10n_info()$`UTF-8`) { 274 | symbol <<- symbol_utf8 275 | } else { 276 | symbol <<- symbol_win 277 | } 278 | 279 | invisible() 280 | } 281 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | 2 | ```{r, setup, echo = FALSE, message = FALSE} 3 | knitr::opts_chunk$set( 4 | comment = "#>", 5 | tidy = FALSE, 6 | error = FALSE) 7 | ``` 8 | 9 | 10 | # clisymbols 11 | 12 | 13 | [![R-CMD-check](https://github.com/r-lib/clisymbols/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/clisymbols/actions/workflows/R-CMD-check.yaml) 14 | [![](https://www.r-pkg.org/badges/version/clisymbols)](https://www.r-pkg.org/pkg/clisymbols) 15 | [![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/clisymbols)](https://www.r-pkg.org/pkg/clisymbols) 16 | [![Codecov test coverage](https://codecov.io/gh/r-lib/clisymbols/graph/badge.svg)](https://app.codecov.io/gh/r-lib/clisymbols) 17 | 18 | 19 | > Unicode symbols with Windows fallbacks 20 | 21 | ![](/screenshot.png) 22 | 23 | Inspired by (and mostly copied from) the 24 | [figures](https://github.com/sindresorhus/figures) JavaScript project. 25 | 26 | ## Install 27 | 28 | Stable version: 29 | 30 | ```{r eval = FALSE} 31 | install.packages("clisymbols") 32 | ``` 33 | 34 | Development version: 35 | 36 | ```{r eval = FALSE} 37 | pak::pak("r-lib/clisymbols") 38 | ``` 39 | 40 | ## Usage 41 | 42 | ```{r} 43 | library(clisymbols) 44 | cat(symbol$tick, "All good\n") 45 | cat(symbol$cross, "Problem\n") 46 | ``` 47 | 48 | Here is a list of all symbols, with their names: 49 | 50 | ```{r} 51 | for (i in seq_along(symbol)) { 52 | cat(symbol[[i]], "\t", names(symbol)[i], "\n", sep = "") 53 | } 54 | ``` 55 | 56 | ### Fallback symbols 57 | 58 | Some terminals do not support (all) Unicode characters, and on these reasonable 59 | ASCII substitutes are used: 60 | 61 | ```{r echo = FALSE} 62 | for (i in seq_along(clisymbols:::symbol_win)) { 63 | cat(format(clisymbols:::symbol_win[[i]], width = 4), 64 | names(clisymbols:::symbol_win)[i], "\n", sep = "") 65 | } 66 | ``` 67 | 68 | # License 69 | 70 | MIT © [Gabor Csardi](https://gaborcsardi.org) and [Sindre Sorhus](https://sindresorhus.com) 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | # clisymbols 6 | 7 | 8 | [![R-CMD-check](https://github.com/r-lib/clisymbols/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/clisymbols/actions/workflows/R-CMD-check.yaml) 9 | [![](https://www.r-pkg.org/badges/version/clisymbols)](https://www.r-pkg.org/pkg/clisymbols) 10 | [![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/clisymbols)](https://www.r-pkg.org/pkg/clisymbols) 11 | [![Codecov test coverage](https://codecov.io/gh/r-lib/clisymbols/graph/badge.svg)](https://app.codecov.io/gh/r-lib/clisymbols) 12 | 13 | 14 | > Unicode symbols with Windows fallbacks 15 | 16 | ![](/screenshot.png) 17 | 18 | Inspired by (and mostly copied from) the 19 | [figures](https://github.com/sindresorhus/figures) JavaScript project. 20 | 21 | ## Install 22 | 23 | Stable version: 24 | 25 | 26 | ```r 27 | install.packages("clisymbols") 28 | ``` 29 | 30 | Development version: 31 | 32 | 33 | ```r 34 | pak::pak("r-lib/clisymbols") 35 | ``` 36 | 37 | ## Usage 38 | 39 | 40 | ```r 41 | library(clisymbols) 42 | cat(symbol$tick, "All good\n") 43 | ``` 44 | 45 | ``` 46 | #> ✔ All good 47 | ``` 48 | 49 | ```r 50 | cat(symbol$cross, "Problem\n") 51 | ``` 52 | 53 | ``` 54 | #> ✖ Problem 55 | ``` 56 | 57 | Here is a list of all symbols, with their names: 58 | 59 | 60 | ```r 61 | for (i in seq_along(symbol)) { 62 | cat(symbol[[i]], "\t", names(symbol)[i], "\n", sep = "") 63 | } 64 | ``` 65 | 66 | ``` 67 | #> ✔ tick 68 | #> ✖ cross 69 | #> ★ star 70 | #> ▇ square 71 | #> ◻ square_small 72 | #> ◼ square_small_filled 73 | #> ◯ circle 74 | #> ◉ circle_filled 75 | #> ◌ circle_dotted 76 | #> ◎ circle_double 77 | #> ⓞ circle_circle 78 | #> ⓧ circle_cross 79 | #> Ⓘ circle_pipe 80 | #> ?⃝ circle_question_mark 81 | #> ● bullet 82 | #> ․ dot 83 | #> ─ line 84 | #> ═ double_line 85 | #> … ellipsis 86 | #> ❯ pointer 87 | #> ℹ info 88 | #> ⚠ warning 89 | #> ☰ menu 90 | #> ☺ smiley 91 | #> ෴ mustache 92 | #> ♥ heart 93 | #> ↑ arrow_up 94 | #> ↓ arrow_down 95 | #> ← arrow_left 96 | #> → arrow_right 97 | #> ◉ radio_on 98 | #> ◯ radio_off 99 | #> ☒ checkbox_on 100 | #> ☐ checkbox_off 101 | #> ⓧ checkbox_circle_on 102 | #> Ⓘ checkbox_circle_off 103 | #> ❓ fancy_question_mark 104 | #> ≠ neq 105 | #> ≥ geq 106 | #> ≤ leq 107 | #> ▔ upper_block_1 108 | #> ▀ upper_block_4 109 | #> ▁ lower_block_1 110 | #> ▂ lower_block_2 111 | #> ▃ lower_block_3 112 | #> ▄ lower_block_4 113 | #> ▅ lower_block_5 114 | #> ▆ lower_block_6 115 | #> ▇ lower_block_7 116 | #> █ lower_block_8 117 | #> █ full_block 118 | ``` 119 | 120 | ### Fallback symbols 121 | 122 | Some terminals do not support (all) Unicode characters, and on these reasonable 123 | ASCII substitutes are used: 124 | 125 | 126 | ``` 127 | #> √ tick 128 | #> x cross 129 | #> * star 130 | #> █ square 131 | #> [ ] square_small 132 | #> [█] square_small_filled 133 | #> ( ) circle 134 | #> (*) circle_filled 135 | #> ( ) circle_dotted 136 | #> (o) circle_double 137 | #> (o) circle_circle 138 | #> (x) circle_cross 139 | #> (|) circle_pipe 140 | #> (?) circle_question_mark 141 | #> * bullet 142 | #> . dot 143 | #> ─ line 144 | #> = double_line 145 | #> ... ellipsis 146 | #> > pointer 147 | #> i info 148 | #> ‼ warning 149 | #> ≡ menu 150 | #> ☺ smiley 151 | #> ┌─┐ mustache 152 | #> ♥ heart 153 | #> ^ arrow_up 154 | #> v arrow_down 155 | #> < arrow_left 156 | #> > arrow_right 157 | #> (*) radio_on 158 | #> ( ) radio_off 159 | #> [x] checkbox_on 160 | #> [ ] checkbox_off 161 | #> (x) checkbox_circle_on 162 | #> ( ) checkbox_circle_off 163 | #> (?) fancy_question_mark 164 | #> != neq 165 | #> >= geq 166 | #> <= leq 167 | #> ^ upper_block_1 168 | #> ^ upper_block_4 169 | #> . lower_block_1 170 | #> _ lower_block_2 171 | #> _ lower_block_3 172 | #> = lower_block_4 173 | #> = lower_block_5 174 | #> * lower_block_6 175 | #> █ lower_block_7 176 | #> █ lower_block_8 177 | #> █ full_block 178 | ``` 179 | 180 | # License 181 | 182 | MIT © [Gabor Csardi](https://gaborcsardi.org) and [Sindre Sorhus](https://sindresorhus.com) 183 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /man/clisymbols-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/clisymbols-package.R 3 | \docType{package} 4 | \name{clisymbols-package} 5 | \alias{clisymbols} 6 | \alias{clisymbols-package} 7 | \title{clisymbols: Unicode Symbols at the R Prompt} 8 | \description{ 9 | A small subset of Unicode symbols, that are useful when building command line applications. They fall back to alternatives on terminals that do not support Unicode. Many symbols were taken from the 'figures' 'npm' package (see \url{https://github.com/sindresorhus/figures}). 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://github.com/r-lib/clisymbols#readme} 15 | \item Report bugs at \url{https://github.com/r-lib/clisymbols/issues} 16 | } 17 | 18 | } 19 | \author{ 20 | \strong{Maintainer}: Gábor Csárdi \email{csardi.gabor@gmail.com} 21 | 22 | Authors: 23 | \itemize{ 24 | \item Sindre Sorhus 25 | } 26 | 27 | Other contributors: 28 | \itemize{ 29 | \item Posit Software, PBC [copyright holder, funder] 30 | } 31 | 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/symbol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/symbols.R 3 | \docType{data} 4 | \name{symbol} 5 | \alias{symbol} 6 | \title{Various handy symbols to use in a command line UI} 7 | \format{ 8 | A named list, see \code{names(symbol)} for all sign names. 9 | } 10 | \usage{ 11 | symbol 12 | } 13 | \description{ 14 | Various handy symbols to use in a command line UI 15 | } 16 | \details{ 17 | On Windows they have a fallback to less fancy symbols. 18 | } 19 | \examples{ 20 | cat(symbol$tick, " SUCCESS\n", symbol$cross, " FAILURE\n", sep = "") 21 | 22 | ## All symbols 23 | cat(paste(format(names(symbol), width = 20), unlist(symbol)), sep = "\n") 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-lib/clisymbols/3ce0802679fd365f9423c283b4cf09489e01c91d/screenshot.png -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(clisymbols) 3 | 4 | test_check("clisymbols") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-all.R: -------------------------------------------------------------------------------- 1 | 2 | context("Names match on various platforms") 3 | 4 | test_that("Names match on all platforms", { 5 | 6 | expect_equal(names(symbol_utf8), names(symbol_win)) 7 | expect_equal(names(symbol_utf8), names(symbol_win_rstudio)) 8 | expect_equal(names(symbol_utf8), names(symbol_win_rgui)) 9 | 10 | }) 11 | --------------------------------------------------------------------------------