summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_core_command_line.eo
blob: 7842949d96d894e3e0b2b0c0a6e9d265a60a25b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
mixin @beta Efl.Core.Command_Line {
  [[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>;
    }
    @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<const(stringshare) @owned> @owned; [[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]]
      }

    }
  }
}