Hello Olivier
On Nov 2 2005, Olivier Lefevre wrote:
If you want to invoke darcs from another program (not in haskell),
what
are your options?
I'm considering the same question, as I'm in the midst of writting a
gui
for darcs on Mac OSX. (see http://patchworks.counsell.org if you want
to
play, but please bear in mind it is very very alpha).
So far I have found options: * Having my program be a user and just
feed
stuff to darcs using stdout and reading stdin. This is complicated
because
darcs is not 100% consistent in the way it prompts users. I'm thinking
about submitting a patch to help rectify this. * Recompiling darcs so
that
it presents an C api. I have read a bit about doing this in the Haskel
docs, and it looks tempermental.
Grateful if anyone else has ideas, or wants to work on making a
programatic
api for darcs.
Tom
Hello,
So, there are already at least 3 projects working on a GUI for darcs
(mine is based on C++/Qt) :-)
-> this is a good sign!
In my opinion the main problem is the inherent interactivity of darcs,
not to protocol/formatting of input and output.
I think it should be possible to extend darcs, so that it runs fully
non-interactively through the normal command-line interface.
For doing this it would probably be necessary to split some darcs
command into smaller parts. For example: A darcs command which outputs
some information and needs a decision from the user (based on these
informations) could be split into
- a command for querying the necessary information
- a command (with arguments based on the gathered information) for
performing an action without need for user decisions
A locking mechanism (as discussed some time ago) could help here to
keep the repository unchanged between these commands.
There is already a flag --interactive. There could be a new flag
--non-interactive which could abort with a message on stderr and a exit
code > 0 whenever the caller provided too less information on the
command line.
I prefer the stdin/stdout/stderr approach over the "special interface
approach" because
- A simple command-line based interface is a good thing for _every_
external tool (shell, python, perl, awk, ...)
- It is much simpler to develop and debug if the user interface and the
programmatic interface are the same
- A loose binding between darcs and the external tools simplify things
when working with several program versions and when distributing
programs.
Just my 2 cents.
Daniel
_______________________________________________
darcs-users mailing list
[email protected]
http://www.abridgegame.org/mailman/listinfo/darcs-users