r-cli-app

Featured

Build command-line apps in R using the Rapp package. Use when creating a CLI tool in R, adding argument parsing to an R script, turning an R script into a command-line app, shipping CLIs in an R package, or using Rapp (the alternative Rscript front-end). Also use for shebang scripts, exec/ directory in R packages, or subcommand-based R tools.

Web & Frontend 474 stars 42 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
89
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Building CLI Apps with Rapp Rapp (v0.3.0) is an R package that provides a drop-in replacement for `Rscript` that automatically parses command-line arguments into R values. It turns simple R scripts into polished CLI apps with argument parsing, help text, and subcommand support — with zero boilerplate. **R ≥ 4.1.0** | **CRAN:** `install.packages("Rapp")` | **GitHub:** `r-lib/Rapp` After installing, put the `Rapp` launcher on PATH: ```r Rapp::install_pkg_cli_apps("Rapp") ``` This places the `Rapp` executable in `~/.local/bin` (macOS/Linux) or `%LOCALAPPDATA%\Programs\R\Rapp\bin` (Windows). --- ## Core Concept: Scripts Are the Spec Rapp scans **top-level expressions** of an R script and converts specific patterns into CLI constructs. This means: 1. The same script works identically via `source()` and as a CLI tool. 2. You write normal R code — Rapp infers the CLI from what you write. 3. Default values in your R code become the CLI defaults. Only top-level assignments are recognized. Assignments inside functions, loops, or conditionals are not parsed as CLI arguments. --- ## Pattern Recognition: R → CLI Mapping This table is the heart of Rapp — each R pattern automatically maps to a CLI surface: | R Top-Level Expression | CLI Surface | Notes | |---|---|---| | `foo <- "text"` | `--foo <value>` | String option | | `foo <- 1L` | `--foo <int>` | Integer option | | `foo <- 3.14` | `--foo <float>` | Float option | | `foo <- TRUE` / `FALSE` | `--foo` / `--no-foo` | Boole...

Details

Author
posit-dev
Repository
posit-dev/skills
Created
9 months ago
Last Updated
3 days ago
Language
R
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category