Skip to content

aql

Tomáš Pecka requested to merge dev-tp into master

@travnja3 I'd like you to take a look at this

Changes:

  • rename aql flags
    • -q is now -c (shell-compatible)
    • -p is now -e (docker-like)
  • sort flags (they apparently print in reverse order)
  • added -f flag, which supports loading commands from file
    • does not add the commands to .aql_history
  • added -i flag, which support staying in interactive mode after -c or -f
    • so we can set up an environment from file and then stay with the defined environment
  • the order of command executing is as specifies on the command line
    • any quit command a stops the execution of all stages
  • aql starts in interactive mode if nothing is specifies

However a problem was with EOT token calling QuitCommand which stopped the evaluation after a file was loaded (EOF). I had two options, either send no EOF from file or implement new EOTCommand which just return a new result EOT. I chose the later. Not sure about it though.


Example usage:

test.aql:

execute string::Parse @Automaton "
DFA 0 1
<>0 0 0" > $dfa
execute "f1"
execute "f2"
$ aql2 -c "execute 1" -c "execute 2" -f test.aql  ; echo "retval -> $?"
1
2
f1
f2
retval -> 0
$ aql2 -c "execute 1" -c "execute 2" -f ../test.aql -i  ; echo "retval -> $?"
1
2
f1
f2
> execute "i"
i
> <EOF>
retval -> 0
aql2 -c "execute 1" -c "quit 55" -f ../test.aql -i  ; echo "retval -> $?"
1
retval -> 55
Edited by Jan Trávníček

Merge request reports