docs_Sample_html
Sample
command_line
<built-in> function command_line()
returns sequence of strings containing each word entered at the command-line that started your program.
Returns:
- path : to either the Euphoria executable (eui, eui.exe, euid.exe, euiw.exe) or to your bound executable file.
- next word : is either the name of your Euphoria main file o (again) the path to your bound executable file.
- extra words : typed by the user. You can use these words in your program.
There are as many entries as words, plus the two mentioned above.
The Euphoria interpreter itself does not use any command-line options. You are free to use any options for your own program. The interpreter does have command line switches though.
The user can put quotes around a series of words to make them into a single argument.
If you convert your program into an executable file, either by binding it, or translationg it to C, you will find that all command-line arguments remain the same, except for the first two, even though your user no longer types "eui" on the command-line (see examples below).
Example 1:
-- The user types: eui myprog myfile.dat 12345 "the end" cmd = command_line() -- cmd will be: {"C:\EUPHORIA\BIN\EUI.EXE", "myprog", "myfile.dat", "12345", "the end"}
See Also:
build_commandline | option_switches | getenv | cmd_parse | show_help |
any_key
include sample.e public procedure any_key(sequence prompt = "Press Any Key to continue...", integer con = 1)
displays a prompt to the user and waits for any keypress.
Parameters:
- prompt : Prompt to display, defaults to "Press Any Key to continue..." .
- con : Either 1 (stdout), or 2 (stderr). Defaults to 1 .
Comments:
This wraps wait_key by giving a clue that the user should press a key, and perhaps do some other things as well.
Example 1:
include std/console.e any_key() -- outputs the message: Press Any Key to continue... -- and waits for a keypress
See Also:
wait_key | maybe_any_key |
parse_commandline
include sample.e public function parse_commandline(sequence cmdline)
parses a command line string breaking it into a sequence of command line options.
Parameters:
- cmdline : Command line sequence (string)
Returns:
A sequence, of command line options
Example 1:
sequence opts = parse_commandline("-v -f '%Y-%m-%d %H:%M'") -- opts = { "-v", "-f", "%Y-%m-%d %H:%M" }
See Also:
build_commandline |
NO_PARAMETER
include sample.e public constant NO_PARAMETER
This option switch does not have a parameter.
See Also:
cmd_parse |
HELP_RID
include sample.e public enum HELP_RID
Additional help routine id.
See Also:
cmd_parse |
VALIDATE_ALL
include sample.e public enum VALIDATE_ALL
Validate all parameters (default).
See Also:
cmd_parse |
NO_VALIDATION
include sample.e public enum NO_VALIDATION
Do not cause an error for an invalid parameter.
See Also:
cmd_parse |