Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gar_setup_menu_do

Setup wizard help - the functions that will execute on different menu options


Description

Setup wizard help - the functions that will execute on different menu options

Usage

gar_setup_menu_do(menu_option, trigger, do_function, stop = FALSE, ...)

Arguments

menu_option

The menu option chosen from menu or gar_setup_menu

trigger

What option will trigger the do_function

do_function

The function in the same order as the menu options

stop

Whether to stop and exit if the function comes back FALSE

...

arguments passed to do_function

Details

The functions should come back with TRUE or FALSE depending on if the setting was successful.

Value

FALSE if setting was not set, TRUE if it was

See Also

Examples

## Not run: 

op <- gar_setup_menu(c("Check all settings",
                       "Configure authentication",
                       "Configure env arg 1",
                       "Configure env arg 2",
                       "Configure something else"
                       ),
                       package_name = "googleAuthR")
                       
choice <- gar_setup_check_session()

custom_env_check_f <- function(choice){
  r <- readline("project-id:")
  gar_setup_env_check("ARG2", 
                      set_to = r, 
                      edit_option = choice == 1, #allow editing of env arg
                      session_user = choice)
  TRUE
}

gar_setup_menu_do(op, c(1,2), my_setup_auth_f, stop = TRUE)
gar_setup_menu_do(op, c(1,3), gar_setup_env_check, 
                  env_arg = "ARG1", set_to = "BLAH", 
                  edit_option = choice == 1, #allow editing of env arg
                  session_user = choice)
gar_setup_menu_do(op, c(1,4), custom_env_check_f)
gar_setup_menu_do(op, c(1,4), my_setup_something_f)


## End(Not run)

googleAuthR

Authenticate and Create Google APIs

v1.4.0
MIT + file LICENSE
Authors
Mark Edmondson [aut, cre] (<https://orcid.org/0000-0002-8434-3881>), Jennifer Bryan [ctb], Johann deBoer [ctb], Neal Richardson [ctb], David Kulp [ctb], Joe Cheng [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.