efl/src/lib/ecore/efl_core_command_line.eo

86 lines
3.0 KiB
Plaintext

mixin @beta Efl.Core.Command_Line requires Efl.Object {
[[A mixin that implements standard functions for command lines.
This object parses the command line that gets passed, later the object can be accessed via accessor or the string
directly.
]]
methods {
@property command {
[[ A commandline that encodes arguments in a command string.
This command is unix shell-style, thus whitespace separates
arguments unless escaped. Also a semi-colon ';', ampersand
'&', pipe/bar '|', hash '#', bracket, square brace, brace
character ('(', ')', '[', ']', '{', '}'), exclamation
mark '!', backquote '`', greator or less than ('>' '<')
character unless escaped or in quotes would cause
args_count/value to not be generated properly, because
it would force complex shell interpretation which
will not be supported in evaluating the arg_count/value
information, but the final shell may interpret this if this
is executed via a command-line shell. To not be a complex
shell command, it should be simple with paths, options
and variable expansions, but nothing more complex involving
the above unescaped characters.
"cat -option /path/file"
"cat 'quoted argument'"
"cat ~/path/escaped\ argument"
"/bin/cat escaped\ argument $VARIABLE"
etc.
It should not try and use "complex shell features" if you
want the arg_count and arg_value set to be correct after
setting the command string. For example none of:
"VAR=x /bin/command && /bin/othercommand >& /dev/null"
"VAR=x /bin/command `/bin/othercommand` | /bin/cmd2 && cmd3 &"
etc.
If you set the command the arg_count/value property contents
can change and be completely re-evaluated by parsing the
command string into an argument array set along with
interpreting escapes back into individual argument strings.
]]
get {
}
values {
commandline : string;
}
}
command_access {
[[ Get the accessor which enables access to each argument that got passed to this object. ]]
return : accessor<stringshare> @move;
}
@property command_array {
[[ Use an array to fill this object
Every element of a string is a argument.
]]
set {
return : bool; [[On success $true, $false otherwise]]
}
values {
array : array<stringshare @move> @move; [[An array where every array field is an argument]]
}
}
@property command_string {
[[Use a string to fill this object
The string will be split at every unescaped ' ', every resulting substring will be a new argument to the
command line.
]]
set {
return : bool; [[On success $true, $false otherwise]]
}
values {
str : string; [[A command in form of a string]]
}
}
}
implements {
Efl.Object.destructor;
}
}