gar_setup_menu_do: Setup wizard help - the functions that will execute on...

Description Usage Arguments Details Value See Also Examples

View source: R/setup_wizard.R

Description

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

Usage

1
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

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()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## 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 documentation built on April 2, 2021, 5:06 p.m.