Skip to content

Commit

Permalink
Merge pull request #72 from jmbarbone/69-release
Browse files Browse the repository at this point in the history
69 release
  • Loading branch information
jmbarbone authored Oct 22, 2023
2 parents 0497739 + 62b69c0 commit d91261d
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 38 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/r-check-verison.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
pull_request:
branches: [main, master]

name: version checks

jobs:
check-r-version:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::gh, any::fuj

- uses: jmbarbone/actions/r-check-version@main
with:
ignore-dev-version: true
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: scribe
Title: Command Argument Parsing
Version: 0.2.0.9001
Version: 0.3.0
Authors@R:
person(
given = "Jordan Mark",
Expand Down Expand Up @@ -31,4 +31,5 @@ Suggests:
withr
Config/testthat/edition: 3
VignetteBuilder: knitr
URL: https://jmbarbone.github.io/scribe/
URL: https://jmbarbone.github.io/scribe/, https://github.com/jmbarbone/scribe
BugReports: https://github.com/jmbarbone/scribe/issues
20 changes: 17 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# scribe (development version)
# scribe 0.3.0

- `convert` is no longer ignored when set in `scribeArg` [#70](https://github.com/jmbarbone/scribe/issues/70)
- `$convert` field now defaults to the newly exported `scribe_convert()` helper. This selects one of three conversions: 1) default (see next bullet), 2) string evaluation, and 3) no conversion.
## Breaking changes

- `$convert` field now defaults to the newly exported `scribe_convert()` helper
- This selects one of three conversions: 1) default (see next bullet), 2) string evaluation, and 3) no conversion.
- default conversions use `value_convert()`, which internally uses `utils::type.convert()` (and some additional steps for dates. Be aware that `type.convert("1", as.is = TRUE)` will return integers, and a decimal should be included if a numeric is desired (e.g., `type.convert("1.", as.is = TRUE)`
- previously, a prototype could be set (e.g., `convert = character()`), which will now fail but can be replaced with a simple function (e.g., `convert = as.character`).

## Bug fixes

- `convert` is no longer ignored when set in `scribeArg` [#70](https://github.com/jmbarbone/scribe/issues/70)

## New features

- `flag` action now accepts `NA` as a default [#67](https://github.com/jmbarbone/scribe/issues/67)

## Non-user facing changes

- GitHub workflow added to maintain version bumps on merge [`jmbarbone/actions/r-check-version`](https://github.com/jmbarbone/actions/blob/main/examples/r-check-version.yaml)

# scribe 0.2.0

## Fixes
Expand Down
19 changes: 10 additions & 9 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ editor_options:

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
```{r setup}
#| include: false
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
Expand All @@ -26,7 +27,7 @@ The goal of scribe is to provide a detailed argument parser for `Rscript`.
This package contains no dependencies outside of `base` and `methods`.
The core functions utilize `ReferenceClasses` under the hood.

```{r}
```{r library}
library(scribe)
```

Expand All @@ -47,7 +48,7 @@ You can enter command arguments as a vector to test out the behavior.
Arguments can be added to the ``r class(command_args())`` class (here as `ca`).
Default behavior tries to parse objects but additional control can be taken.

```{r}
```{r example-simple}
ca <- command_args(c("-a", "1", "-b", "2"))
ca$add_argument("-a")
ca$add_argument("-b")
Expand All @@ -58,17 +59,17 @@ str(args$a + args$b)

Control

```{r}
```{r example-controls}
# don't convert numbers
ca <- command_args(c("-a", "1", "-b", "1.0"))
ca$add_argument("-a", convert = character())
ca$add_argument("-b", convert = character())
ca$add_argument("-a", convert = as.character)
ca$add_argument("-b", convert = as.character)
ca$parse()
# convert numbers to integers
ca <- command_args(c("verbose", "1", "1.5", "1.9"))
ca$add_argument("verbose", action = "flag")
ca$add_argument("...", convert = integer())
ca$add_argument("...", convert = as.integer)
ca$parse()
# use functions for more control
Expand All @@ -85,7 +86,7 @@ The example below uses a function to call this file, but if it is added to your
r-file -a 1 -b 9
```

```{r}
```{r example-script}
lines <- "
#! /usr/bin/env -S Rscript --vanilla
Expand Down Expand Up @@ -116,7 +117,7 @@ rscript(file, "-a 0")
rscript(file, "-a 0 -b 10")
```

```{r}
```{r remove}
#| include: false
file.remove(file)
```
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Control
``` r
# don't convert numbers
ca <- command_args(c("-a", "1", "-b", "1.0"))
ca$add_argument("-a", convert = character())
ca$add_argument("-b", convert = character())
ca$add_argument("-a", convert = as.character)
ca$add_argument("-b", convert = as.character)
ca$parse()
#> $a
#> [1] "1"
Expand All @@ -62,13 +62,13 @@ ca$parse()
# convert numbers to integers
ca <- command_args(c("verbose", "1", "1.5", "1.9"))
ca$add_argument("verbose", action = "flag")
ca$add_argument("...", convert = integer())
ca$add_argument("...", convert = as.integer)
ca$parse()
#> $verbose
#> [1] TRUE
#>
#> $...
#> NULL
#> integer(0)

# use functions for more control
ca <- command_args(c("verbose", "12-9-2022", "12-10-2022"))
Expand All @@ -79,7 +79,7 @@ ca$parse()
#> [1] TRUE
#>
#> $...
#> NULL
#> Date of length 0
```

You’ll probably use `{scribe}` within small scripts that can be called
Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Test environments

* local R installation, R 4.3.0
* local R installation, R 4.3.1
* windows-latest, release
* macOS-latest release
* ubuntu-latest devel, release, oldrel-1

## R CMD check results

0 errors | 0 warnings | 1 note
0 errors | 0 warnings | 0 note

* This is a minor release
* Contains a bug fix and some new features
* Contains a breaking change and a bug fix, along with some minor improvents
2 changes: 2 additions & 0 deletions man/scribe-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions revdep/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Platform

|field |value |
|:--------|:--------------------------------------|
|version |R version 4.3.0 (2023-04-21) |
|os |Ubuntu 23.04 |
|system |x86_64, linux-gnu |
|ui |RStudio |
|language |(EN) |
|collate |en_US.UTF-8 |
|ctype |en_US.UTF-8 |
|tz |America/New_York |
|date |2023-05-21 |
|rstudio |2023.03.1+446 Cherry Blossom (desktop) |
|pandoc |2.19.2 @ /usr/bin/pandoc |
|field |value |
|:--------|:-----------------------------------------------------------------------------------|
|version |R version 4.3.1 (2023-06-16) |
|os |Ubuntu 22.04.3 LTS |
|system |x86_64, linux-gnu |
|ui |RStudio |
|language |(EN) |
|collate |en_US.UTF-8 |
|ctype |en_US.UTF-8 |
|tz |America/New_York |
|date |2023-10-21 |
|rstudio |2023.12.0-daily+155 Ocean Storm (desktop) |
|pandoc |3.1.8 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/tools/x86_64/ (via rmarkdown) |

# Dependencies

|package |old |new |Δ |
|:-------|:-----|:----------|:--|
|scribe |0.1.0 |0.1.0.9006 |* |
|package |old |new |Δ |
|:-------|:-----|:-----|:--|
|scribe |0.2.0 |0.3.0 |* |

# Revdeps

0 comments on commit d91261d

Please sign in to comment.