Merge pull request #2450 from urbit/m/dbug-state-slapper

dbug: allow complex, hoon-based state queries
This commit is contained in:
ixv 2020-03-12 11:09:26 -07:00 committed by GitHub
commit 54d1e7eb63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 13 deletions

View File

@ -1,8 +1,12 @@
:: +dbug: tell /lib/dbug app to print some generic state
::
:: :app +dbug
:: the entire state
:: :app +dbug %bowl
:: the entire bowl
:: :app +dbug [direction] [specifics]
:: :app +dbug [%state 'thing']
:: data at thing.state. allows for complex hoon, like '(lent thing)'
:: :app +dbug [direction specifics]
:: all in subs matching the parameters
:: direction: %incoming or %outgoing
:: specifics:
@ -19,14 +23,14 @@
*
:: inline arguments
::
args=?(~ [what=?(%bowl %state) ~] [=what =about ~])
args=?(~ [what=?(%bowl %state) ~] [=poke ~])
:: named arguments
::
~
==
:- %dbug
?- args
~ [%state *about]
[@ ~] [what.args *about]
[@ * ~] [what about]:args
~ [%state '']
[@ ~] ?-(what.args %bowl [%bowl ~], %state [%state ''])
[[@ *] ~] poke.args
==

View File

@ -3,11 +3,11 @@
:: usage: %-(agent:dbug your-agent)
::
|%
+$ what
$? %bowl
%state
%incoming
%outgoing
+$ poke
$% [%bowl ~]
[%state grab=cord]
[%incoming =about]
[%outgoing =about]
==
::
+$ about
@ -31,12 +31,17 @@
=^ cards agent (on-poke:ag mark vase)
[cards this]
=/ dbug
!<([=what =about] vase)
!<(poke vase)
=; out=^vase
((slog (sell out) ~) [~ this])
?- what.dbug
?- -.dbug
%bowl !>(bowl)
%state on-save:ag
::
%state
=? grab.dbug =('' grab.dbug) '-'
%+ slap
(slop on-save:ag !>([bowl=bowl ..zuse]))
(ream grab.dbug)
::
%incoming
!>