Skip to content

Bug with opt_help when script run from command line using Rscript #1

@brainfood

Description

@brainfood

When I use the opt_help() function in my script, and then run the script from the command line with the help option:
Rscript my_r_script.R --help

I get the following error after the help message:

Error in quit(save = FALSE):
  one of "yes", "no", "ask" or "default" expected.
Calls: <Anonymous> -> quit
Execution halted

Looking at the code for the opt_help() function, I think the problem is line 65:
if( ! interactive() ) quit( save = FALSE )

Looking at the R docs for the quit function, the save argument is expecting one of "no", "yes", "ask", or "default", rather than a boolean value. So the following change should fix this problem:
if( ! interactive() ) quit( save = "no")

I ran into this issue on Windows 10 with R v3.6.0 and optigrab v0.9.2.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions