Nikita Karetnikov <nik...@karetnikov.org> skribis: >> BTW, what did you think of the idea of using recutils format as the >> output? (Either as the sole output format, or otherwise as a secondary >> format.) > > I like the idea. It’s always better to use a documented format, > especially when it comes with a mode for Emacs. And don’t forget that > ‘--search’ already uses recutils. I didn’t say anything before because > I haven’t tried to implement this part yet.
I’m asking because if we do that, ‘--list-generations’ may just as well print out *all* the generation records. Users who want to select only less than one-month old generations can do that with ‘recsel’, and we don’t have anything more to do. WDYT? OTOH, for ‘--delete-generations’ it will still be more convenient to support ‘--delete-generations’. >>> Do you see any problems? Please check everything (especially the >>> ‘first-month’ and ‘last-month’ functions). > >> Better yet: write test cases. :-) > > I have some tests, but you have to modify ‘int’ and the other related > procedures to use them. So it’s not an option. > > I’m also not sure what’s the best way to test the ‘first-month’ and > ‘last-month’ functions (the validation part). Any ideas? I think you find it difficult to test because the parsing and generation enumeration are intermingled. If parsing is separated as I suggested, with a ‘string->date-range’ procedure, then it becomes trivial to write test cases for that. >> The code otherwise looks OK, but disentangling parsing from validation >> will make it even more pleasant IMO. > > I agree. I just haven’t found a way that avoids unnecessary repetition. What do you think of the separation I proposed? > Could you share your thoughts on other things that are marked with > “XXX”? I don’t have much to say on these at this stage, but I think it’d be easier to comment on the next version of the patch. :-) Thanks, Ludo’.