Menu

Read commandline arguments

Help
Clueid
2022-03-21
2022-03-21
  • Clueid

    Clueid - 2022-03-21

    In any programming language, it's possible to read commands and options from cli. E.g:

    python myprogram.py arg1 arg2 arg3
    

    How can I do the same in Asymptote? Simple example: a file named circle.asy draws a circle with radius r where r is read from the cli like this: asy circle.asy 1.7. Output: circle with radius 1.7 units.

     
  • John Bowman

    John Bowman - 2022-03-21

    Here's an example:

    asy -V test -u r=1.7

    where test.asy contains

    unitsize(1cm);
    
    real r=1;
    
    usersetting();
    draw(circle((0,0),r));
    
     

Log in to post a comment.