Setup wizard help - the functions that will execute on different menu options
gar_setup_menu_do(menu_option, trigger, do_function, stop = FALSE, ...)
menu_option
: The menu option chosen from menu or gar_setup_menutrigger
: What option will trigger the do_function
do_function
: The function in the same order as the menu optionsstop
: Whether to stop and exit if the function comes back FALSE...
: arguments passed to do_function
FALSE if setting was not set, TRUE if it was
The functions should come back with TRUE or FALSE depending on if the setting was successful.
## 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)
Other setup functions: gar_setup_auth_check()
, gar_setup_auth_key()
, gar_setup_clientid()
, gar_setup_edit_renviron()
, gar_setup_env_check()
, gar_setup_menu()
Useful links