Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-lib/cliapp
Rich Command Line Applications
https://github.com/r-lib/cliapp
Last synced: 4 days ago
JSON representation
Rich Command Line Applications
- Host: GitHub
- URL: https://github.com/r-lib/cliapp
- Owner: r-lib
- License: other
- Created: 2018-09-12T11:56:25.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T07:57:26.000Z (7 months ago)
- Last Synced: 2024-10-05T03:48:56.274Z (about 1 month ago)
- Language: R
- Size: 374 KB
- Stars: 62
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - r-lib/cliapp - Rich Command Line Applications (R)
README
---
title: cliapp
output:
github_document:
toc: true
toc_depth: 3
includes:
before_body: header.md
---```{r, setup, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
comment = "#>",
fig.path = "man/figures/"
)
```## Superseded
This package is superseded, and we focus on the cli package now:
https://github.com/r-lib/cli## Installation
Stable version:
```{r eval = FALSE}
install.packages("cliapp")
```Development version:
```{r eval = FALSE}
pak::pak("r-lib/cliapp")
```## Usage
This README uses the simple theme, included in the package, see
`?simple_theme()`.```{r echo = FALSE, results = "hide"}
options(crayon.enabled = TRUE)
options(crayon.colors = 256)
crayon::num_colors(forget = TRUE)
options(cli.unicode = TRUE)
library(cliapp)
start_app(theme = simple_theme(), output = "stdout")
``````r
library(cliapp)
start_app(theme = simple_theme())
```### Headings
`cli_h1()`, `cli_h2()` and `cli_h3()` create three levels of headings:
```r
cli_h1("Title")
cli_h2("Subtitle")
cli_h3("Subsubtitle")
``````{r headings, render=cliapp:::knit_print.html, echo = FALSE}
capture.output(cli_h1("Title"))
capture.output(cli_h2("Subtitle"))
capture.output(cli_h3("Subsubtitle"))
```### Text and inline markup
All (non-verbatim) outputted text runs through `glue::glue()`. In addition
to glue interpolation, cliapp also supports inline markup via the
`{markup text}` form. The builtin theme defines inline markup classes,
see `?inline-markup`.```r
cli_text("{emph Emphasized text}, {strong Strong} importance.
A piece of code: {code sum(a) / length(a)}. Package names:
{pkg cliapp}, file names: {path /usr/bin/env}, etc.")
``````{r inline-markup, render=cliapp:::knit_print.html, echo = FALSE}
capture.output(cli_text("{emph Emphasized text}, {strong Strong} importance.
A piece of code: {code sum(a) / length(a)}. Package names:
{pkg cliapp}, file names : {path /usr/bin/env}, etc."))
```### Alerts
```r
cli_alert("Generic alert")
cli_alert_danger("Something went horribly wrong")
cli_alert_warning("Better watch out!")
cli_alert_info("About to download 1.4GiB of data.")
cli_alert_success("All downloads finished successfully")
``````{r alerts, render=cliapp:::knit_print.html, echo = FALSE}
capture.output(cli_alert("Generic alert"))
capture.output(cli_alert_danger("Something went horribly wrong"))
capture.output(cli_alert_warning("Better watch out!"))
capture.output(cli_alert_info("About to download 1.4GiB of data."))
capture.output(cli_alert_success("All downloads finished successfully"))
```### Lists
Ordered, unordered and definition lists, they can be nested.
See `?cli_ol()`, `?cli_ul()`, `?cli_dl()` and `?cli_it()`.```r
cli_div(theme = list(ol = list("margin-left" = 2)))
cli_ul("one", .close = FALSE)
cli_ol(c("foo", "bar", "foobar"))
cli_it("two")
cli_end()
cli_end()
``````{r lists, render=cliapp:::knit_print.html, echo = FALSE}
capture.output({
cli_div(theme = list(ol = list("margin-left" = 2)))
cli_ul("one", .close = FALSE)
cli_ol(c("foo", "bar", "foobar"))
cli_it("two")
cli_end()
cli_end()
})
```### Progress bars
Progress bars are supported via the
[progress package](https://github.com/r-lib/progress).## License
MIT © RStudio