Skip to content

Commit

Permalink
Update commands example
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Solymos <psolymos@gmail.com>
  • Loading branch information
psolymos committed Mar 27, 2023
1 parent 92e983e commit 565a7e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: rconfig
Type: Package
Title: Manage R Configuration at the Command Line
Version: 0.2.1
Date: 2023-02-12
Date: 2023-03-18
Authors@R: c(
person(given = "Peter",
family = "Solymos",
Expand Down
4 changes: 4 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ Rscript mtcars.R --vars cyl disp hp
Let's see how to use sub-commands:

```{bash}
## This will print messages:
Rscript commands.R model
## This will not print messages:
Rscript commands.R model --silent
```

```{bash}
Expand Down
8 changes: 6 additions & 2 deletions inst/examples/commands.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/usr/bin/env Rscript
CONFIG <- rconfig::rconfig()

SILENT <- rconfig::value(CONFIG$silent, FALSE)

model <- function() {
message("Model ...")
if (!SILENT)
message("Model ...")
# your logic comes here
}

pred <- function() {
message("Predict ...")
if (!SILENT)
message("Predict ...")
# your logic comes here
}

Expand Down

0 comments on commit 565a7e1

Please sign in to comment.