4
0

input.adoc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [#arg-textbox]
  2. = Input: Textbox
  3. Many times you need to customize how an action/shell command is run, with arguments. For example;
  4. ----
  5. echo "Hello world"
  6. ----
  7. In the example above, `Hello world` is an argument passed to the `echo` command. OliveTin allows you to add pre-defined, and free-text arguments to commands in this way. Below is the OliveTin version of the `echo` command shown above;
  8. [source,yaml]
  9. .`config.yaml`
  10. ----
  11. actions:
  12. - title: echo a message
  13. icon: smile
  14. shell: echo {{ message }}
  15. arguments:
  16. - name: message
  17. default: Hello World
  18. type: ascii_sentence
  19. actions:
  20. - title: Print a message
  21. shell: echo {{ message }}
  22. arguments:
  23. - name: message
  24. description: The message you want to print out on the shell.
  25. title: Your Message
  26. default: Hello World
  27. type: ascii_sentence
  28. ----
  29. This will give you a normal button, like this;
  30. image::args/input/args1.png[]
  31. However, when you click on it, you'll get a prompt to enter arguments, like this;
  32. image::args/input/args2.png[]
  33. You'll see that the type is set to `ascii_sentence`. This applies fairly safe
  34. input validation to arguments, so that only a-z, 0-9, spaces and .'s are allowed.
  35. When you start the action, and it's finished, go to the "logs" view to view the output of the command we've just run.
  36. image::args/input/args3.png[]