Code Monkey home page Code Monkey logo

cliapp's Introduction

cliapp

Create Rich Command Line Applications

lifecycle R-CMD-check CRAN RStudio mirror downloads Codecov test coverage

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


Superseded

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

Installation

Stable version:

install.packages("cliapp")

Development version:

pak::pak("r-lib/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

cliapp's People

Contributors

gaborcsardi avatar jimhester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cliapp's Issues

Release 0.1.0

Prepare for release:

  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Polish NEWS
  • If new failures, update email.yml then revdepcheck::revdep_email_maintainers()

Perform release:

  • Bump version (in DESCRIPTION and NEWS)
  • devtools::check_win_devel() (again!)
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Tag release
  • pkgdown::build_site()
  • Bump dev version
  • Write blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Template from r-lib/usethis#338

Error when _R_CHECK_LENGTH_1_LOGIC2_=true

I'm pretty sure the error is from within selectr, but I thought I'd open the issue here too because this is where I ran into it.

library(cliapp)

withr::with_envvar(
  new = c("_R_CHECK_LENGTH_1_LOGIC2_"="TRUE"),
  code = cli_alert('test')
)
#> Error in !is.na(match) && match[1] == 1: 'length(x) = 2 > 1' in coercion to 'logical(1)'

Created on 2019-08-13 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       macOS Mojave 10.14.6        
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2019-08-13                  
#> 
#> ─ Packages ──────────────────────────────────────────────────────────────
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
#>  backports     1.1.4   2019-04-10 [1] CRAN (R 3.6.0)
#>  callr         3.3.1   2019-07-18 [1] CRAN (R 3.6.0)
#>  cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
#>  cliapp      * 0.1.0   2018-12-16 [1] CRAN (R 3.6.0)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
#>  devtools      2.1.0   2019-07-06 [1] CRAN (R 3.6.0)
#>  digest        0.6.20  2019-07-04 [1] CRAN (R 3.6.0)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.0)
#>  fansi         0.4.0   2018-10-05 [1] CRAN (R 3.6.0)
#>  fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
#>  glue          1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
#>  highr         0.8     2019-03-20 [1] CRAN (R 3.6.0)
#>  hms           0.5.0   2019-07-09 [1] CRAN (R 3.6.0)
#>  htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.6.0)
#>  knitr         1.24    2019-08-08 [1] CRAN (R 3.6.0)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.0)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
#>  pillar        1.4.2   2019-06-29 [1] CRAN (R 3.6.0)
#>  pkgbuild      1.0.4   2019-08-05 [1] CRAN (R 3.6.0)
#>  pkgconfig     2.0.2   2018-08-16 [1] CRAN (R 3.6.0)
#>  pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
#>  prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
#>  processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.0)
#>  progress      1.2.2   2019-05-16 [1] CRAN (R 3.6.0)
#>  ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
#>  R6            2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
#>  Rcpp          1.0.2   2019-07-25 [1] CRAN (R 3.6.0)
#>  remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.0)
#>  rlang         0.4.0   2019-06-25 [1] CRAN (R 3.6.0)
#>  rmarkdown     1.14    2019-07-12 [1] CRAN (R 3.6.0)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
#>  selectr       0.4-1   2018-04-06 [1] CRAN (R 3.6.0)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
#>  stringi       1.4.3   2019-03-12 [1] CRAN (R 3.6.0)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 3.6.0)
#>  testthat      2.2.1   2019-07-25 [1] CRAN (R 3.6.0)
#>  tibble        2.1.3   2019-06-06 [1] CRAN (R 3.6.0)
#>  usethis       1.5.1   2019-07-04 [1] CRAN (R 3.6.0)
#>  vctrs         0.2.0   2019-07-05 [1] CRAN (R 3.6.0)
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
#>  xfun          0.8     2019-06-25 [1] CRAN (R 3.6.0)
#>  xml2          1.2.2   2019-08-09 [1] CRAN (R 3.6.0)
#>  yaml          2.2.0   2018-07-25 [1] CRAN (R 3.6.0)
#>  zeallot       0.1.0   2018-01-28 [1] CRAN (R 3.6.0)
#> 
#> [1] /Users/4468739/Library/R/3.6/library
#> [2] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

Release cliapp 0.1.2

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Bump required R version in DESCRIPTION to 4.0
  • Polish NEWS
  • usethis::use_github_links()
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

Upkeep for cliapp (2023)

Pre-history

  • usethis::use_readme_rmd()
  • usethis::use_roxygen_md()
  • usethis::use_github_links()
  • usethis::use_pkgdown_github_pages() (no pkgdown and superseded package)
  • usethis::use_tidy_github_labels()
  • usethis::use_tidy_style()
  • urlchecker::url_check()

2020

  • usethis::use_package_doc()
  • usethis::use_testthat(3)
  • Align the names of R/ files and test/ files

2021

  • Remove check environments section from cran-comments.md
  • Use lifecycle instead of artisanal deprecation messages

2022

  • Handle and close any still-open master --> main issues
  • usethis:::use_codecov_badge("r-lib/cliapp")
  • Update pkgdown site using instructions at https://tidytemplate.tidyverse.org (no pkgdown and superseded package)
  • Update lifecycle badges with more accessible SVGs: usethis::use_lifecycle()

2023

  • Update copyright holder in DESCRIPTION: person("Posit Software, PBC", role = c("cph", "fnd"))
  • Run devtools::document() to re-generate package-level help topic with DESCRIPTION changes
  • usethis::use_tidy_logo()
  • usethis::use_tidy_coc()
  • Use pak::pak("r-lib/cliapp") in README
  • Consider running usethis::use_tidy_dependencies() and/or replace compat files with use_standalone()
  • Use cli errors or file an issue if you don't have time to do it now
  • usethis::use_standalone("r-lib/rlang", "types-check") instead of home grown argument checkers;
    or file an issue if you don't have time to do it now
  • Add alt-text to pictures, plots, etc; see https://posit.co/blog/knitr-fig-alt/ for examples

Eternal

  • usethis::use_mit_license()
  • usethis::use_package("R", "Depends", "3.6")
  • usethis::use_tidy_description()
  • usethis::use_tidy_github_actions()
  • devtools::build_readme()
  • Re-publish released site if needed

Created on 2023-11-03 with usethis::use_tidy_upkeep_issue(), using usethis v2.2.2.9000

Move `master` branch to `main`

The master branch of this repository will soon be renamed to main, as part of a coordinated change across several GitHub organizations (including, but not limited to: tidyverse, r-lib, tidymodels, and sol-eng). We anticipate this will happen by the end of September 2021.

That will be preceded by a release of the usethis package, which will gain some functionality around detecting and adapting to a renamed default branch. There will also be a blog post at the time of this master --> main change.

The purpose of this issue is to:

  • Help us firm up the list of targetted repositories
  • Make sure all maintainers are aware of what's coming
  • Give us an issue to close when the job is done
  • Give us a place to put advice for collaborators re: how to adapt

message id: euphoric_snowdog

Release cliapp 0.1.1

Prepare for release:

  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Polish NEWS
  • If new failures, update email.yml then revdepcheck::revdep_email_maintainers()

Perform release:

  • Bump version (in DESCRIPTION and NEWS)
  • devtools::check_win_devel() (again!)
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Tag release
  • pkgdown::build_site()
  • Bump dev version
  • Write blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Template from r-lib/usethis#338

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.