forked from reconquest/shdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme-example.sh
More file actions
57 lines (51 loc) · 1.15 KB
/
readme-example.sh
File metadata and controls
57 lines (51 loc) · 1.15 KB
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
#!/bin/bash
# @file libexample
# @brief A library that solves some common problems.
# @description
# The project solves lots of problems:
# * a
# * b
# * c
# * etc
# @description My super function.
# Not thread-safe.
#
# @example
# echo "test: $(say-hello World)"
#
#
# @option -h | --help Display help.
# @option -v<value> | --value=<value> Set a value.
#
# @arg $1 string A value to print
#
# @stdout Output 'Hello $1'.
# It hopes you say Hello back.
# @stderr Output 'Oups !' on error.
# It did it again.
#
# @exitcode 0 If successful.
# @exitcode 1 If an empty string passed.
#
# @see validate()
# @see [shdoc](https://github.com/reconquest/shdoc).
say-hello() {
if [[ ! "$1" ]]; then
echo "Oups !" >&2
return 1;
fi
echo "Hello $1"
}
# @section Sub-section
# @description Some grouped functions.
# Sections allow a sub-set of other annotations and will ignore unsupported ones.
# @see README
# @example
# # @section example
# # @see [some-link](./README.md)
# # @example ...
# @description This is nested
deeper-level() { echo; }
# @endsection
# @description Back up again
up-again() { echo; }