Skip to content

Commit 874e4b4

Browse files
committed
Adds -v arg for printing version, and -c arg for printing config info
1 parent b9dab86 commit 874e4b4

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ notes
33

44
**notes** is a command line program that provides quick access, editing capability, and search functionality to all notes under a directory of your choosing. Under your notes directory, you can organize your notes into any folder structure you like.
55

6-
The default extension for notes is `md`. The extension is not part of notes' syntax. **notes** supports **_tab completion_** and **_wildcard matching_** from any directory: the `*` wildcard is replaced by `@`.
6+
The default extension for notes is `.md`. The extension is not part of notes' syntax. **notes** supports **_tab completion_** and **_wildcard matching_** from any directory: the `*` wildcard is replaced by `@`.
77

88

99
## Features
10-
1110
* Fast, natural syntax for manipulating notes **from any directory**
1211
* Quickly find notes using tab completion
1312
* Pass a note to any program, match notes using globbing patterns
@@ -18,6 +17,7 @@ The default extension for notes is `md`. The extension is not part of notes' syn
1817

1918
## Installation
2019

20+
2121
#### OSX
2222
```sh
2323
brew tap kylebebak/tap
@@ -28,23 +28,26 @@ brew install notes
2828
To make **notes** truly sweet, insert the following into your shell startup file (e.g. `.bash_profile`):
2929
`which notes >/dev/null && . "$( notes -i )"`
3030

31+
3132
#### Notes directory
3233
The first time you run **notes**, you will be prompted to choose your notes directory. You need to use the **absolute path** to an existing directory. If you ever want to change it, run `notes -d <directory>`.
3334

34-
#### Other systems
3535

36-
Clone this repo, or download and unzip the [tarball](https://github.com/kylebebak/notes/archive/1.0.1.tar.gz). Either add the `bin` directory to your `$PATH`, or create a symlink in your `$PATH` that points to the **notes** executable in the `bin` directory.
36+
#### Other systems
37+
Clone this repo, or download and unzip the [tarball](https://github.com/kylebebak/notes/archive/1.1.0.tar.gz). Either add the `bin` directory to your `$PATH`, or create a symlink in your `$PATH` that points to the **notes** executable in the `bin` directory.
3738

3839
If you execute **notes** via symlink, *make sure that the name of the target file (the symlink) is also notes*. Otherwise, tab completions won't work.
3940

4041

4142
## Extra
43+
The default extension for notes is `.md`, because markdown is great. If you want to change it, edit the `_ext` variable in `_config/env.sh`.
4244

43-
* The default extension for notes is `md`, because markdown is great. If you want to change it, edit the `_ext` variable in `_config/env.sh`.
45+
If you want to print your current config, and the absolute path to the config file, execute `notes -c`.
4446

4547

4648
## Usage
4749

50+
4851
#### Syntax
4952
```
5053
zero arguments : list all notes
@@ -54,6 +57,7 @@ two arguments <program> <glob_pattern>: pass all matched notes as ar
5457
g.t. two arguments <program> <notes>: pass notes as arguments to program
5558
```
5659

60+
5761
#### Options
5862
```
5963
[ -n NEW_NOTE ] create and open a note
@@ -67,7 +71,7 @@ g.t. two arguments <program> <notes>: pass notes as arguments to p
6771
[ -d DIR ] set notes directory (absolute path to existing directory)
6872
```
6973

70-
Execute `notes -h` to get help and see more options.
74+
Execute `notes -h` to get help and see more options, and `notes -v` to print the current version.
7175

7276

7377
## License

_helpers/helpers.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ ${_bold}SYNOPSIS${_normal}
107107
108108
${_bold}DESCRIPTION${_normal}
109109
[ ${_bold}-h${_normal} ] get help (display this page)
110-
[ ${_bold}-d${_normal} DIR ] set notes directory (absolute paths to existing directory)
110+
[ ${_bold}-v${_normal} ] print version
111+
[ ${_bold}-c${_normal} ] print notes config, and path to config file
112+
[ ${_bold}-d${_normal} DIR ] set notes directory (absolute path to existing directory)
111113
[ ${_bold}-f${_normal} PATTERN ] find notes: search for notes matching pattern (all matches)
112114
[ ${_bold}-F${_normal} PATTERN ] find notes: search for notes matching pattern (note names only)
113115
[ ${_bold}-m${_normal} NOTE NEW_NOTE ] move a note (change its name). can not be used to overwrite an existing note

bin/notes

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cd "${_dir}" 2>/dev/null; dir=`pwd -P`; cd "${dir}"
3333

3434
# main program logic
3535
# --------------------------------------------------
36-
optstring=":Cd:f:F:him:n:N:Op:Pr:R:"
36+
optstring=":Ccd:f:F:hvim:n:N:Op:Pr:R:"
3737
# completions options that need to be parsed before potentially exiting program
3838
# --------------------------------------------------
3939
while getopts "$optstring" opt; do
@@ -88,6 +88,23 @@ while getopts "$optstring" opt; do
8888
exit 0
8989
;;
9090

91+
# print version and exit
92+
# ------------------------------
93+
v)
94+
echo "notes version 1.1.0"
95+
exit 0
96+
;;
97+
98+
# print notes config and exit
99+
# ------------------------------
100+
c)
101+
printf "notes config file: ${rootdir}/_config/env.sh\n\n"
102+
103+
cat ${rootdir}/_config/env.sh
104+
echo
105+
exit 0
106+
;;
107+
91108
# open notes directory
92109
# ------------------------------
93110
O)

0 commit comments

Comments
 (0)