Handle price directives

korrat
Jan 3, 2023, 6:33 PM
6MYJDQ3IMOSMAOTJ2FAFE6EQRT4O36YI4I77ZWZ57APZRYER5X6QC

Dependencies

  • [2] SMBQYFPG Enable access to timestamps for directives
  • [3] 2JBFREZG enable additional warnings
  • [4] QRIJE4AQ add a simple pretty printer for beancount directives
  • [*] YDK6X6PP add a library of important types for beancount
  • [*] SEEWF7KX Implement metadata on transactions
  • [*] 5S4MZHL5 pretty print decimals using icu
  • [*] NSWL54NM allow deriving pretty printing config from a set of directives

Change contents

  • edit in common/beancount-types/src/lib.rs at line 18
    [7.7434]
    [3.4225]
    pub use crate::price::Price;
  • edit in common/beancount-types/src/lib.rs at line 36
    [7.7449]
    [6.5978]
    mod price;
  • edit in common/beancount-types/src/lib.rs at line 42
    [3.4427]
    [3.4427]
    Price(Price),
  • edit in common/beancount-types/src/lib.rs at line 50
    [6.6560]
    [6.6560]
    Self::Price(price) => price.date,
  • edit in common/beancount-types/src/lib.rs at line 58
    [6.6778]
    [6.6778]
    Directive::Price(_) => None,
  • edit in common/beancount-types/src/lib.rs at line 69
    [2.1067]
    [2.1067]
    Directive::Price(_) => None, // TODO
  • edit in common/beancount-types/src/lib.rs at line 79
    [6.7145]
    [6.7145]
    Directive::Price(price) => price.fmt(f),
  • edit in common/beancount-pretty-printer/src/lib.rs at line 11
    [3.240]
    [3.240]
    use beancount_types::Price;
  • edit in common/beancount-pretty-printer/src/lib.rs at line 35
    [8.369]
    [3.366]
    // TODO consider having signs line up in a single column
  • edit in common/beancount-pretty-printer/src/lib.rs at line 166
    [3.1786]
    [3.1786]
    Directive::Balance(balance) => self.print_balance(balance),
    Directive::Price(price) => self.print_price(price),
  • edit in common/beancount-pretty-printer/src/lib.rs at line 169
    [3.1874][3.1874:1946]()
    Directive::Balance(balance) => self.print_balance(balance),
  • edit in common/beancount-pretty-printer/src/lib.rs at line 191
    [3.2494]
    [3.2494]
    pub fn print_price(&mut self, price: &Price) -> Result<()> {
    write!(self.inner, "{price}")
    }
  • edit in common/beancount-pretty-printer/src/lib.rs at line 391
    [9.5071]
    [9.5071]
    Directive::Price(_) => Either::Left(rayon::iter::once(Self::zero())),