File: README.md

package info (click to toggle)
r-cran-cliapp 0.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 472 kB
  • sloc: sh: 13; makefile: 2
file content (121 lines) | stat: -rw-r--r-- 3,200 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
cliapp
================


> Create Rich Command Line Applications

<!-- badges: start -->
[![lifecycle](https://img.shields.io/badge/lifecycle-superseded-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R-CMD-check](https://github.com/r-lib/cliapp/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/cliapp/actions/workflows/R-CMD-check.yaml)
[![](https://www.r-pkg.org/badges/version/cliapp)](https://www.r-pkg.org/pkg/cliapp)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/cliapp)](https://www.r-pkg.org/pkg/cliapp)
[![Codecov test coverage](https://codecov.io/gh/r-lib/cliapp/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/cliapp?branch=main)
<!-- badges: end -->

Create rich command line applications, with colors, headings, lists, alerts,
progress bars, etc. It uses CSS for theming.

---

- [Superseded](#superseded)
- [Installation](#installation)
- [Usage](#usage)
  - [Headings](#headings)
  - [Text and inline markup](#text-and-inline-markup)
  - [Alerts](#alerts)
  - [Lists](#lists)
  - [Progress bars](#progress-bars)
- [License](#license)

## Superseded

This package is superseded, and we focus on the cli package now:
<https://github.com/r-lib/cli>

## Installation

Stable version:

``` r
install.packages("cliapp")
```

Development version:

``` r
pak::pak("r-lib/cliapp")
```

## Usage

This README uses the simple theme, included in the package, see
`?simple_theme()`.

``` 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")
```

![](man/figures/headings-1.png)<!-- -->![](man/figures/headings-2.png)<!-- -->![](man/figures/headings-3.png)<!-- -->

### 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.")
```

![](man/figures/inline-markup-1.png)<!-- -->

### 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")
```

![](man/figures/alerts-1.png)<!-- -->![](man/figures/alerts-2.png)<!-- -->![](man/figures/alerts-3.png)<!-- -->![](man/figures/alerts-4.png)<!-- -->![](man/figures/alerts-5.png)<!-- -->

### 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()
```

![](man/figures/lists-1.png)<!-- -->

### Progress bars

Progress bars are supported via the [progress
package](https://github.com/r-lib/progress).

## License

MIT © RStudio