Lines
87.5 %
Functions
50 %
Branches
100 %
//! The notes under a form. They never depend on the focused field, so the dialog keeps its
//! size when the focus moves; the keys are listed by Help.
use crate::form::FormKind;
const DATES: &str = "Dates: YYYY-MM-DD or RFC3339.";
const TIME: &str = "Date: YYYY-MM-DDTHH:MM";
fn notes(kind: FormKind) -> &'static [&'static str] {
match kind {
FormKind::Options => &[
"Theme: role = fg on bg. Keys: scope: key = action.",
"One per line. A keymap applies once saved.",
],
FormKind::SshKeyAdd => &["Paste one public key line."],
FormKind::CsvSave => &["An existing file asks first."],
FormKind::Report(_) | FormKind::TransactionFilter => &[DATES],
FormKind::TransactionCreate | FormKind::TransactionEdit => &[TIME],
FormKind::FilterRow(_) => &["Tag: entities split by spaces, one value per line."],
FormKind::ConfigSet
| FormKind::CommodityCreate
| FormKind::AccountCreate
| FormKind::FilterAdd
| FormKind::TemplatePick
| FormKind::AccountMerge
| FormKind::CommodityConvert
| FormKind::AccountEdit
| FormKind::CommodityEdit
| FormKind::TagCreate
| FormKind::TagEdit
| FormKind::TemplateCreate
| FormKind::TemplateEdit
| FormKind::ScriptCreate
| FormKind::ScriptEdit => &[],
}
/// The footer lines of a `kind` form.
pub(super) fn footer_lines(kind: FormKind) -> Vec<String> {
notes(kind).iter().map(|note| (*note).to_string()).collect()