File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ __notes_cmd ()
2525 open:'<name> Open a notes for editing by full name'
2626 rm:'[-r | --recursive] <name> Remove note, or folder if -r or --recursive is given]'
2727 cat:'<name> Display a note by name'
28+ --version:'Show version'
2829 --help:'Show usage'
2930 )
3031 _describe -t sub-commands 'sub commands' list && _ret=0
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # Version
4+ notes_version=" 0.4.3"
5+
36# Default Date string before config
47QUICKNOTE_FORMAT=" quicknote-%Y-%m-%d"
58NOTES_EXT=" md"
@@ -237,6 +240,13 @@ override this by setting \$NOTES_DIRECTORY to your preferred path.
237240EOF
238241}
239242
243+ version () {
244+ local name=$( basename $0 )
245+ cat << EOF
246+ $name $notes_version
247+ EOF
248+ }
249+
240250main () {
241251 local ret=0
242252 local cmd=" "
@@ -275,6 +285,9 @@ main() {
275285 --help | -help | -h )
276286 cmd=" usage"
277287 ;;
288+ --version | -version )
289+ cmd=" version"
290+ ;;
278291 * )
279292 printf " $1 is not a recognized notes command.\n\n"
280293 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