shell dot on steroids https://pagure.io/shellfu

tricky.sh 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  2. #
  3. # Some arbitrary text like License and authourship info
  4. # this time the text is somewhat longer and has its own
  5. # paragraphs.
  6. #
  7. # This is an example of such paragraph, which does span
  8. # more than one, more than two, in fact, actually about
  9. # three lines.
  10. #
  11. # '
  12. here can be code
  13. # or things that look a bit like module docstrings
  14. #
  15. #
  16. # A test module with functions, variables and long docstring
  17. #
  18. # This one has even the module docstring longer as it can then
  19. # form a testcase of such module.
  20. #
  21. # # Usage #
  22. #
  23. # This module is only used for testing of docstring parsing
  24. # and object (by which we mean *function* or *variable*, not
  25. # some OOP stuff) printing functionality.
  26. #
  27. # The internal format is Markdown-ish, but is parsed as plain
  28. # text. But still, as an example we will try to use some
  29. # common Markdown. For example, this:
  30. #
  31. # #!/bin/bash
  32. # #
  33. #
  34. # is like first two lines of this file look like.
  35. #
  36. #
  37. # This is already NOT part of above doc
  38. #
  39. #
  40. # A test variable with a short docstring
  41. #
  42. TRICKY_LIMIT=42
  43. TRICKY_REVERSED=42
  44. #
  45. # It's also possible to have docstring *after* the doc
  46. #
  47. echo $TRICKY_LIMIT:$TRICKY_REVERSED
  48. #
  49. # A test variable with a long docstring
  50. #
  51. # Not really long but the longer version (header plus
  52. # the rest)
  53. #
  54. TRICKY_DEBUG=${TRICKY_DEBUG:-false}
  55. tricky_foo() {
  56. #
  57. # A test function with a short docstring
  58. #
  59. #shellfu disable=ZZ
  60. local foo=$1
  61. local bar
  62. bar=$foo
  63. echo "$bar"
  64. }
  65. tricky_other_function() {
  66. #
  67. # A test function with a long docstring
  68. #
  69. # Not really long but the longer version (header plus
  70. # the rest)
  71. #
  72. :
  73. }