Method: KeepassKpscript::Database#entries_string

Defined in:
lib/keepass_kpscript/database.rb

#entries_string(select, field, fail_if_not_exists: false, fail_if_no_entry: false, spr: false) ⇒ Object

Get field string values from entries.

Parameters
  • select (Select): The entries selector

  • field (String): Field to be selected

  • fail_if_not_exists (Boolean): Do we fail if the field does not exist? [default: false]

  • fail_if_no_entry (Boolean): Do we fail if no entry was found? [default: false]

  • spr (Boolean): So we Spr-compile the value of the retrieved field? [default: false]

Result
  • Array<String>: List of retrieved field values



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/keepass_kpscript/database.rb', line 59

def entries_string(
  select,
  field,
  fail_if_not_exists: false,
  fail_if_no_entry: false,
  spr: false
)
  args = [
    '-c:GetEntryString',
    select.to_s,
    "-Field:\"#{field}\""
  ]
  args << '-FailIfNotExists' if fail_if_not_exists
  args << '-FailIfNoEntry' if fail_if_no_entry
  args << '-Spr' if spr
  execute_kpscript(*args).split("\n")
end