Command-line arguments: Difference between revisions
Content added Content deleted
m (Improve lang example: Replace "-langArgs" with "--") |
No edit summary |
||
Line 2,446: | Line 2,446: | ||
<syntaxhighlight lang="smalltalk">Smalltalk commandLineArguments printCR. |
<syntaxhighlight lang="smalltalk">Smalltalk commandLineArguments printCR. |
||
Smalltalk commandLineArguments do:[:each | each printCR]</syntaxhighlight> |
Smalltalk commandLineArguments do:[:each | each printCR]</syntaxhighlight> |
||
=={{header|SparForte}}== |
|||
As a structured script. |
|||
<syntaxhighlight lang="ada">#!/usr/local/bin/spar |
|||
pragma annotate( summary, "printargs" ) |
|||
@( description, "Retrieve the list of command-line arguments given to the program." ) |
|||
@( description, "Example command line: " ) |
|||
@( description, "myprogram -c 'alpha beta' -h 'gamma'" ) |
|||
@( category, "tutorials" ) |
|||
@( author, "Ken O. Burtch" ) |
|||
@( see_also, "http://rosettacode.org/wiki/Command-line_arguments" ); |
|||
pragma license( unrestricted ); |
|||
pragma software_model( nonstandard ); |
|||
pragma restriction( no_external_commands ); |
|||
procedure printargs is |
|||
begin |
|||
put_line( "The command is '" & command_line.command_name & "'" ); |
|||
for Arg in 1..command_line.argument_count loop |
|||
put( "Argument" ) @ (Arg ) @ ( " is '" ) @ |
|||
( command_line.argument(Arg) ) @ ("'"); |
|||
new_line; |
|||
end loop; |
|||
end printargs;</syntaxhighlight> |
|||
=={{header|Standard ML}}== |
=={{header|Standard ML}}== |