21 lines
467 B
Text
21 lines
467 B
Text
|
|
[indent=4]
|
||
|
|
/*
|
||
|
|
Command line arguments, in Genie
|
||
|
|
|
||
|
|
valac commandLine.gs
|
||
|
|
./commandLine sample arguments 'four in total here, including args 0'
|
||
|
|
*/
|
||
|
|
|
||
|
|
init
|
||
|
|
|
||
|
|
// Output the number of arguments
|
||
|
|
print "%d command line argument(s):", args.length
|
||
|
|
|
||
|
|
// Enumerate all command line arguments
|
||
|
|
for s in args
|
||
|
|
print s
|
||
|
|
|
||
|
|
// to reiterate, args[0] is the command
|
||
|
|
if args[0] is not null
|
||
|
|
print "\nWith Genie, args[0] is the command: %s", args[0]
|