Yes, this works great in the console!
However I can see why it is better to stick to the standard functions. In my 
case, this does not work when running via an Ant apply task, since Ant has its 
own loggers and is doing something internally which prevents jumping to the 
start of the line. Perhaps there is a way to do this with Ant, but I do not 
think this is a good idea for portability...

Thanks for the insight, Daniel

-----Ursprüngliche Nachricht-----
Von: Christian Grün <christian.gr...@gmail.com> 
Gesendet: Mittwoch, 15. März 2023 17:37
An: Zimmel, Daniel <d.zim...@esvmedien.de>
Cc: basex-talk@mailman.uni-konstanz.de
Betreff: Re: [basex-talk] Progress bar (again)

> Thanks, I was hoping there might be some way to update the output result 
> instead of simply adding to output.
> I just ran a 420 minutes regular expressions query, which I might be 
> going to optimize now because there is not much visible progress 
> anymore :-P

Sorry, now I got it. You could try something like this:

for $i in 1 to 100
let $string := string-join((
  (: yields &#xd;, and jumps to the beginning of the current line :)
  string:cr(),
  'FORTSCHRITT: ',
  (1 to $i idiv 5) ! '.',
  $i, '%'
))
return (
  prof:sleep(50),
  (: calls System.err.println($string) :)
  Q{java.lang.System}err() => Q{java.io.PrintStream}print($string)
)

I think we won’t offer a built-in function for that, as the result of functions 
like fn:trace, prof:dump, etc. will be sent to different output channels, some 
of which won’t allow the overwriting of output that has previously been sent.

Hope this helps,
Christian

Reply via email to