{"id":13857349,"url":"https://github.com/r-lib/cli","last_synced_at":"2025-05-13T19:02:50.255Z","repository":{"id":20350642,"uuid":"89723016","full_name":"r-lib/cli","owner":"r-lib","description":"Tools for making beautiful \u0026 useful command line interfaces","archived":false,"fork":false,"pushed_at":"2025-04-25T21:01:33.000Z","size":31331,"stargazers_count":667,"open_issues_count":94,"forks_count":71,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-27T23:59:28.556Z","etag":null,"topics":["cli","r"],"latest_commit_sha":null,"homepage":"https://cli.r-lib.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-28T16:10:28.000Z","updated_at":"2025-04-25T20:49:49.000Z","dependencies_parsed_at":"2024-02-09T01:47:05.360Z","dependency_job_id":"d41b1629-04a5-409d-8a66-57e2a4d31e66","html_url":"https://github.com/r-lib/cli","commit_stats":{"total_commits":1354,"total_committers":44,"mean_commits":"30.772727272727273","dds":"0.10635155096011817","last_synced_commit":"d9febb5860083e6d028da42d5f6a3888754c798d"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010792,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","r"],"created_at":"2024-08-05T03:01:34.029Z","updated_at":"2025-05-13T19:02:50.248Z","avatar_url":"https://github.com/r-lib.png","language":"R","readme":"---\ntitle: cli\noutput:\n  github_document:\nalways_allow_html: yes\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE, cache = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README\",\n  out.width = \"100%\",\n  cache = TRUE,\n  asciicast_theme = if (Sys.getenv(\"IN_PKGDOWN\") == \"true\") \"pkgdown\" else \"readme\"\n)\nSys.setenv(CLI_TICK_TIME = \"100\")\nasciicast::init_knitr_engine(\n  startup = quote({\n    library(cli)\n    set.seed(1) }),\n  echo = TRUE,\n  echo_input = FALSE\n)\n```\n\n\u003e Helpers for Developing Command Line Interfaces\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/r-lib/cli/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/cli/actions/workflows/R-CMD-check.yaml)\n[![](https://www.r-pkg.org/badges/version/cli)](https://www.r-pkg.org/pkg/cli)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/cli)](https://www.r-pkg.org/pkg/cli)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/cli/graph/badge.svg)](https://app.codecov.io/gh/r-lib/cli)\n\u003c!-- badges: end --\u003e\n\nA suite of tools to build attractive command line interfaces\n(CLIs), from semantic elements: headers, lists, alerts, paragraphs,\netc. Supports theming via a CSS-like language. It also contains a\nnumber of lower level CLI elements: rules, boxes, trees, and\nUnicode symbols with ASCII alternatives. It supports ANSI markup\nfor terminal colors and font styles.\n\n---\n\n# Features\n\n* Build a CLI using semantic elements: headings, lists, alerts, paragraphs.\n* Theming via a CSS-like language.\n* Terminal colors and font styles.\n* All cli text can contain interpreted string literals, via the\n  [glue](https://github.com/tidyverse/glue) package.\n* Progress bars from R and C code.\n* Error and warning messages with rich text formatting.\n* Support for pluralized messages.\n* ANSI styled string manipulation.\n\n# Installation\n\nInstall the stable version from CRAN:\n\n```r\ninstall.packages(\"cli\")\n```\n\nInstall the development version from GitHub:\n\n```r\npak::pak(\"r-lib/cli\")\n```\n\n# Short tour\n\nSome of the more commonly used cli elements, and features.\n\n## Short alert messages\n\nOne liner messages to inform or warn.\n\n```{asciicast alert-success}\npkgs \u003c- c(\"foo\", \"bar\", \"foobar\")\ncli_alert_success(\"Downloaded {length(pkgs)} packages.\")\n```\n\n```{asciicast alert-info}\ndb_url \u003c- \"example.com:port\"\ncli_alert_info(\"Reopened database {.url {db_url}}.\")\n```\n\n```{asciicast alert-warning}\ncli_alert_warning(\"Cannot reach GitHub, using local database cache.\")\n```\n\n```{asciicast alert-danger}\ncli_alert_danger(\"Failed to connect to database.\")\n```\n\n```{asciicast alert}\ncli_alert(\"A generic alert\")\n```\n\n## Headings\n\nThree levels of headings.\n\n```{asciicast h1}\ncli_h1(\"Heading 1\")\n```\n\n```{asciicast h2}\ncli_h2(\"Heading 2\")\n```\n\n```{asciicast h3}\ncli_h3(\"Heading 3\")\n```\n\n## Lists\n\nOrdered, unordered and description lists, that can be nested.\n\n```{asciicast lists}\nfun \u003c- function() {\n  cli_ol()\n  cli_li(\"Item 1\")\n  ulid \u003c- cli_ul()\n  cli_li(\"Subitem 1\")\n  cli_li(\"Subitem 2\")\n  cli_end(ulid)\n  cli_li(\"Item 2\")\n  cli_end()\n}\nfun()\n```\n\n## Themes\n\nTheming via a CSS-like language.\n\n```{asciicast themes}\nfun \u003c- function() {\n  cli_div(theme = list(span.emph = list(color = \"orange\")))\n  cli_text(\"This is very {.emph important}\")\n  cli_end()\n  cli_text(\"Back to the {.emph previous theme}\")\n}\nfun()\n```\n\n## Command substitution\n\nAutomatic command substitution via the\n[glue](https://github.com/tidyverse/glue) package.\n\n```{asciicast glue}\nsize \u003c- 123143123\ndt \u003c- 1.3454\ncli_alert_info(c(\n  \"Downloaded {prettyunits::pretty_bytes(size)} in \",\n  \"{prettyunits::pretty_sec(dt)}\"))\n```\n\n## Pluralization\n\nPluralization support.\n\n```{asciicast plurals}\nnfiles \u003c- 3\nndirs \u003c- 1\ncli_alert_info(\"Found {nfiles} file{?s} and {ndirs} director{?y/ies}.\")\n```\n\n## Progress bars\n\n```{asciicast progress-setup, include = FALSE, cache = FALSE}\noptions(cli.progress_show_after = 0)\noptions(cli.progress_clear = FALSE)\n```\n\n```{asciicast progress}\n#| asciicast_knitr_output = \"svg\",\n#| asciicast_at = \"all\",\n#| asciicast_cursor = FALSE\nclean \u003c- function() {\n  cli_progress_bar(\"Cleaning data\", total = 100)\n  for (i in 1:100) {\n    Sys.sleep(5/100)\n    cli_progress_update()\n  }\n}\nclean()\n```\n\n# Documentation\n\nSee at [`https://cli.r-lib.org/`](https://cli.r-lib.org/reference/index.html)\nand also in the installed package: `help(package = \"cli\")`.\n\n# Code of Conduct\n\nPlease note that the cli project is released with a\n[Contributor Code of Conduct](https://cli.r-lib.org/dev/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n\n# License\n\nMIT © Posit Software, PBC\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fcli/lists"}