The attr(,"config") always points to the name requested, regardless of inheritance or use of the "default" value. If inherited, then there is the $inherits value in the list, but if the name is not found then the default entry is returned with no indication that it is being used.
Short of using names(yaml::yaml.load_file("...")), is there a way to determine if the named account is not present?
config::get(config = "", file = authfn, use_parent = FALSE)
# $inherits
# [1] "localpg"
# attr(,"config")
# [1] ""
# attr(,"file")
# [1] "C:\\Users\\r2\\.config.yml"
Perhaps something like attr(,"defaultused") <- TRUE could be a simple start. An extreme solution might provide a vector of inherited names:
default:
user: joe
bob:
user: bob
def1:
inherits: bob
def2:
inherits: def1
def3:
inherits: def2
config::get(config = "def3", file = authfn, use_parent = F)
# $user
# [1] "bob"
# $inherits
# [1] "def2"
# attr(,"config")
# [1] "def3"
# attr(,"file")
# [1] "C:\\Users\\r2\\.config.yml"
# attr(,"inherited")
# [1] "def2" "def1" "bob"
(I realize having the default value is important, and that one intent is for it to always return something if the file is present and the file is structured correctly with at least a default: entry. I'm not suggesting changing that.)
The
attr(,"config")always points to thenamerequested, regardless of inheritance or use of the "default" value. If inherited, then there is the$inheritsvalue in the list, but if the name is not found then the default entry is returned with no indication that it is being used.Short of using
names(yaml::yaml.load_file("...")), is there a way to determine if the named account is not present?Perhaps something like
attr(,"defaultused") <- TRUEcould be a simple start. An extreme solution might provide a vector of inherited names:(I realize having the default value is important, and that one intent is for it to always return something if the file is present and the file is structured correctly with at least a
default:entry. I'm not suggesting changing that.)