File tree Expand file tree Collapse file tree 1 file changed +26
-26
lines changed Expand file tree Collapse file tree 1 file changed +26
-26
lines changed Original file line number Diff line number Diff line change 24
24
# spark -h
25
25
# # => Prints the spark help text.
26
26
27
- # Prints the help text for spark.
28
- help ()
29
- {
30
- cat << EOF
31
-
32
- USAGE:
33
- spark [-h] VALUE,...
34
-
35
- EXAMPLES:
36
- spark 1 5 22 13 53
37
- ▁▁▃▂█
38
- spark 0,30,55,80,33,150
39
- ▁▂▃▄▂█
40
- echo 9 13 5 17 1 | spark
41
- ▄▆▂█▁
42
- EOF
43
- }
44
-
45
27
# Generates sparklines.
46
28
#
47
29
# $1 - The data we'd like to graph.
@@ -77,13 +59,31 @@ spark()
77
59
}
78
60
79
61
# If we're being sourced, don't worry about such things
80
- [[ ${# BASH_SOURCE[@]} -eq 1 ]] || return
62
+ if [ " $BASH_SOURCE " == " $0 " ]; then
63
+ # Prints the help text for spark.
64
+ help ()
65
+ {
66
+ cat << EOF
81
67
82
- # show help for no arguments if stdin is a terminal
83
- if { [ -z " $1 " ] && [ -t 0 ] ; } || [ " $1 " == ' -h' ]
84
- then
85
- help
86
- exit
87
- fi
68
+ USAGE:
69
+ spark [-h] VALUE,...
70
+
71
+ EXAMPLES:
72
+ spark 1 5 22 13 53
73
+ ▁▁▃▂█
74
+ spark 0,30,55,80,33,150
75
+ ▁▂▃▄▂█
76
+ echo 9 13 5 17 1 | spark
77
+ ▄▆▂█▁
78
+ EOF
79
+ }
88
80
89
- spark ${@:- `cat`}
81
+ # show help for no arguments if stdin is a terminal
82
+ if { [ -z " $1 " ] && [ -t 0 ] ; } || [ " $1 " == ' -h' ]
83
+ then
84
+ help
85
+ exit
86
+ fi
87
+
88
+ spark ${@:- `cat`}
89
+ fi
You can’t perform that action at this time.
0 commit comments