CashUtil progress

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CashUtil progress

Neil Williams-2
CashUtil can now load the GnuCash XML backend, select an object (if you know
one of the values), edit (certain parameters of) that object and save the
amended book back to GnuCash XML.

i.e. it is now a semi-usable GnuCash CLI. It's not intuitive yet, but it's
still early days.

Searching for an entity is simply a case of specifying the command - edit,
print or delete - the object type, the parameter to compare and the value to
find in that parameter:

edit Account name Assets

I'll see about enhancing the command parser so that a more verbose command is
also supported :

edit Account where name = Assets

(I prefer the shorthand version myself - there'll be full SQL query support
for the more complex queries.) Parameter names or values that contain spaces
need to be quoted.

edit Account name "Current Assets"

One-line edits will also be supported:

edit Account code 0054 10055

or in verbose:
edit Account where code = 0054 set 10055
equivalent to the SQL:
update Account set code = 10055 where code = 0054;
(which will also be supported within the shell, later.)

Undo is also working, use 'commit' to place the data into the book, quit to
undo the edit and leave the entity unchanged. Users are prompted about dirty
books and 'pre-selection' is also enabled: if only one entity of the
requested type exists there is no need to specify search terms.

I've tested the file written out by CashUtil and GnuCash can load it and
correctly shows the amended data. (For the test, I simply edited the code
parameter of the Assets account.)

$ ./cashutil --shell
cashutil> load books/gnucash.xml
cashutil> print Account name Assets
Name                     Type         Value

smallest-commodity-unit  gint32       100
desc                     string       Assets
reconciled               numeric      0/1
present                  numeric      0/1
parent-account           Account      (null)
account-type             string       ASSET
code                     string
tax-related-p            boolean      false
balance                  numeric      0/1
notes                    string
name                     string       Assets
future-minimum           numeric      0/1
non-standard-scu         boolean      false
book                     Book         (null)
guid                     guid         df8f3225765a28afe2eb14e014c20201
kvp                      kvp          (null)
cleared                  numeric      0/1

Not all parameters are editable, use 'explain' to see the list of editable
parameters for 'Account'.

cashutil> edit Account name Assets
cash/Account> edit code 0054
cash/Account> commit
cashutil> write
cashutil> q

Thank you for using cashutil.

Next is to fix the file type identification (between GnuCash and QSF), make
the selection shell more intuitive and helpful (by offering a list of
available objects etc.) and fix some problems with the SQL export where the
objects are copied as empty.
:-(

The website tarball will be updated later today.

--

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


_______________________________________________
gnucash-devel mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

attachment0 (196 bytes) Download Attachment