Jump to content

Parse command-line arguments: Difference between revisions

Line 459:
Rest: all the way down</pre>
If there are multiple <tt>MAIN</tt> subs, they are differentiated by multiple dispatch. A help message can automatically be generated for all the variants. The intent of this mechanism is not to cover every possible switch structure, but just to make it drop-dead easy to handle most of the common ones.
 
=={{header|Phix}}==
<lang Phix>sequence res = command_line()
?res</lang>
{{out}}
Interpreted: res[1] is the interpreter, res[2] the source
<pre>
> p test nc -v -n -z -w 1 192.168.1.2 1-1000
{"C:\\Program Files (x86)\\Phix\\p.exe","C:\\Program Files (x86)\\Phix\\test.exw","nc","-v","-n","-z","-w","1","192.168.1.2","1-1000"}
</pre>
Compiled: both res[1] and res[2] are the executable
<pre>
> p -c test nc -v -n -z -w 1 192.168.1.2 1-1000
{"C:\\Program Files (x86)\\Phix\\test.exe","C:\\Program Files (x86)\\Phix\\test.exe","nc","-v","-n","-z","-w","1","192.168.1.2","1-1000"}
> test nc -v -n -z -w 1 192.168.1.2 1-1000
{"C:\\Program Files (x86)\\Phix\\test.exe","C:\\Program Files (x86)\\Phix\\test.exe","nc","-v","-n","-z","-w","1","192.168.1.2","1-1000"}
</pre>
 
=={{header|Python}}==
7,805

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.