cliapp v0.1.0

0

Monthly downloads

0th

Percentile

Create Rich Command Line Applications

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

Readme

cliapp

Create Rich Command Line Applications

lifecycle Linux Build Status Windows Build status CRAN RStudio mirror downloads Coverage Status

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


Installation

install.packages("cliapp")

Usage

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

library(cliapp)
start_app(theme = simple_theme())

Headings

cli_h1(), cli_h2() and cli_h3() create three levels of headings:

cli_h1("Title")
cli_h2("Subtitle")
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.

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

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

Lists

Ordered, unordered and definition lists, they can be nested. See ?cli_ol(), ?cli_ul(), ?cli_dl() and ?cli_it().

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.

License

MIT © RStudio

Functions in cliapp

Name Description
start_app Start, stop, query the default cli application
themes CLI themes
console_width Determine the width of the console
containers CLI containers
cli_alert CLI alerts
cli_ul Unordered CLI list
cli_text CLI text
inline-markup CLI inline markup
simple_theme A simple CLI theme
cli_verbatim CLI verbatim text
cliapp Create Rich Command Line Applications
cli_it CLI list item(s)
cli_div Generic CLI container
cli_dl Definition list
cli_ol Ordered CLI list
cli_end Close a CLI container
cli_par CLI paragraph
cli_progress_bar CLI progress bar
cli_h1 CLI headers
builtin_theme The built-in CLI theme
No Results!

Last month downloads

Details

License MIT + file LICENSE
LazyData true
URL https://github.com/r-lib/cliapp#readme
BugReports https://github.com/r-lib/cliapp/issues
RoxygenNote 6.1.1
Encoding UTF-8
NeedsCompilation no
Packaged 2018-12-05 09:41:39 UTC; gaborcsardi
Repository CRAN
Date/Publication 2018-12-16 14:40:05 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/cliapp)](http://www.rdocumentation.org/packages/cliapp)