On Sat, Aug 30, 2014 at 6:46 AM, Stephan Beal <sgb...@googlemail.com> wrote:

> You do now :). The first script-available feature was the DB layer. It
> seems i didn't bind the pseudo-recursive transactions bits, but everything
> else one needs for DB access seems to be there, and the require.s2 module
> makes it really easy to write mini-apps/modules to import data:
>

Out of curiosity's sake, i went ahead and used the various existing pieces
to create a standalone mini-timeilne application (to see if any needed
parts are missing). It's entire implementation:

#!/usr/bin/env f-s2sh
assert Fossil.require;
Fossil.require(
['fsl/db/checkout', // opens the current checkout
 'fsl/timeline/basic' // array of recent event table entries
],
proc(co,tl){
    const j2h = Fossil.time.julianToHuman;
    const fmt = "%1$-8s %2$.10s @ %3$s by %4$s";
    const typeMap = { // maps event.type labels to strings
        g: 'tag', w: 'wiki',
        ci: 'checkin', e: 'event',
        t: 'ticket'
    };
    tl.eachIndex(proc(v){
        print(fmt.applyFormat(typeMap[v.type]|||'???',
                              v.uuid,
                              j2h(v.mtime),
                              v.user));
        print('\t',v.comment);
    });
});


which outputs:

[stephan@host:~/cvs/fossil/libfossil/s2]$ ./timeline.s2
checkin  b9d3c27a12 @ 2014-08-30 06:25:15 by stephan
 latest s2/requires2.
checkin  7a4fa849d3 @ 2014-08-27 18:47:25 by stephan
 latest s2, added missing require.s2 scripts.
tag      3c78d1c612 @ 2014-08-26 21:21:11 by stephan
 Edit [0f48e69758f241506f43bb4c6370baef0ef09f5a|0f48e69758]: Edit check-in
comment.
checkin  0f48e69758 @ 2014-08-26 21:20:23 by stephan
 latest s2, lots of little stuff, one notable corner-case bug (bogus OOM
error).
checkin  acc01d60c7 @ 2014-08-26 17:26:53 by stephan
 accommodated API changes.



-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to