File tree 3 files changed +34
-0
lines changed 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ __notes_cmd ()
25
25
open:'<name> Open a notes for editing by full name'
26
26
rm:'[-r | --recursive] <name> Remove note, or folder if -r or --recursive is given]'
27
27
cat:'<name> Display a note by name'
28
+ --version:'Show version'
28
29
--help:'Show usage'
29
30
)
30
31
_describe -t sub-commands 'sub commands' list && _ret=0
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ # Version
4
+ notes_version=" 0.4.3"
5
+
3
6
# Default Date string before config
4
7
QUICKNOTE_FORMAT=" quicknote-%Y-%m-%d"
5
8
NOTES_EXT=" md"
@@ -237,6 +240,13 @@ override this by setting \$NOTES_DIRECTORY to your preferred path.
237
240
EOF
238
241
}
239
242
243
+ version () {
244
+ local name=$( basename $0 )
245
+ cat << EOF
246
+ $name $notes_version
247
+ EOF
248
+ }
249
+
240
250
main () {
241
251
local ret=0
242
252
local cmd=" "
@@ -275,6 +285,9 @@ main() {
275
285
--help | -help | -h )
276
286
cmd=" usage"
277
287
;;
288
+ --version | -version )
289
+ cmd=" version"
290
+ ;;
278
291
* )
279
292
printf " $1 is not a recognized notes command.\n\n"
280
293
cmd=" usage"
Original file line number Diff line number Diff line change
1
+ #! ./test/libs/bats/bin/bats
2
+
3
+ load ' helpers'
4
+
5
+ setup () {
6
+ setupNotesEnv
7
+ }
8
+
9
+ teardown () {
10
+ teardownNotesEnv
11
+ }
12
+
13
+ notes=" ./notes"
14
+
15
+ @test " Should print version successfully if requested" {
16
+ run $notes --version
17
+
18
+ assert_success
19
+ assert_line --regexp ' ^.+ [0-9]\.[0-9]\.[0-9]$'
20
+ }
You can’t perform that action at this time.
0 commit comments