Skip to content

Commit 1e76bdf

Browse files
committed
merge conflicts merged
1 parent 90df684 commit 1e76bdf

25 files changed

+1796
-113
lines changed

README.md

+28-20
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,28 @@ This application is licensed under the 3 clause BSD licence. See
4444

4545
## Contributing to the Project
4646

47-
Contributions are welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
47+
Contributions are welcome. Please see [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) for details.
4848

4949

5050
## Notes and Notebooks
5151

5252
This Notes system supports multiple notebooks.
5353

54-
- To manage your notes you simply use the *[notes](USING_NOTES.md)* command.
55-
- To manage your notebooks you use the *[notebook](MANAGING_NOTEBOOKS.md)* command.
54+
- To manage your notes you simply use the *[notes](docs/USING_NOTES.md)* command.
55+
- To manage your notebooks you use the *[notebook](docs/MANAGING_NOTEBOOKS.md)* command.
5656

5757

5858
## Installing and Uninstalling
5959

60-
Adding or removing this software is easy. See [INSTALL.md](INSTALL.md)
60+
Adding or removing this software is easy. See [docs/INSTALL.md](docs/INSTALL.md)
6161
or [UNINSTALL.md](UNINSTALL.md) for details.
6262

6363

6464
## Setup and configuration
6565

6666
After installation you need to setup the environment. Standard Unix
6767
Notes does this with environment variables and the *[notes
68-
init](USING_NOTES.md)* command.
68+
init](docs/USING_NOTES.md)* command.
6969

7070

7171
## Managing Notes
@@ -84,8 +84,8 @@ The *notes(1)* application automatically replaces spaces in the note title
8484
with underscores.
8585

8686
For full details of commands available see
87-
[USING_NOTES.md](USING_NOTES.md) for details or view the *notes(1)* man
88-
page.
87+
[docs/USING_NOTES.md](docs/USING_NOTES.md) for details or view the
88+
*notes(1)* man page.
8989

9090

9191
## Changing GnuPG encryption keys
@@ -103,40 +103,48 @@ of your notes. Using this command allows you to change the encryption
103103
keys for all of your notes at once rather than having to change them
104104
manually.
105105

106-
See [USING_NOTES.md](USING_NOTES.md) for details.
106+
See [docs/USING_NOTES.md](docs/USING_NOTES.md) for details.
107107

108108

109109
## Managing Notebooks
110110

111-
You can have multiple notebooks to organize your notes. Each notebook is
112-
just a plain UNIX directory and so could be managed by standard unix
111+
You can have multiple notebooks to organise your notes. Each notebook is
112+
just a plain UNIX directory and so could be managed by standard UNIX
113113
directory tools.
114114

115115
But to make it easier we have provided a tool called *notebook* that has
116-
a series of subcommands for managing notebooks. See
117-
[MANAGING_NOTEBOOKS.md](MANAGING_NOTEBOOKS.md) for full details of the
118-
command and subcommands.
116+
a series of sub-commands for managing notebooks. See
117+
[docs/MANAGING_NOTEBOOKS.md](docs/MANAGING_NOTEBOOKS.md) for full details of the
118+
command and sub-commands.
119+
120+
121+
## Journals
122+
123+
Also included is a journal(1) system for encrypted journal entries. See
124+
[docs/JOURNAL.md](docs/JOURNAL.md) for details.
119125

120126

121127
## Yubikey Integration
122128

123129
Standard Unix Notes supports GPG Keys on Yubikeys for GPG decryption.
124-
For more details see [YUBIKEYS.md](YUBIKEYS.md).
130+
For more details see [docs/YUBIKEYS.md](docs/YUBIKEYS.md).
125131

126132

127133
## PIV Integration
128134

129-
For more details on the proposed PIV integration see [PIV.md](PIV.md)
135+
For more details on the proposed PIV integration see [docs/PIV.md](docs/PIV.md)
130136

131137
---
132138

133139
## RELEASE NOTES
134140

135-
See [RELEASE-NOTES.md](RELEASE-NOTES.md) for details.
141+
See [docs/RELEASE-NOTES.md](docs/RELEASE-NOTES.md) for details.
142+
136143

137144
## ROADMAP
138145

139-
See [ROADMAP.md](ROADMAP.md) for details.
146+
See [docs/ROADMAP.md](docs/ROADMAP.md) for details.
147+
140148

141149
## PACKAGING
142150

@@ -146,9 +154,9 @@ We currently package for the following:
146154
- Debian .deb package suitable for Debian and Ubuntu based distributions
147155

148156
We are looking to package for other distributions depending on
149-
availability: see [PACKAGING.md](PACKAGING.md) for details.
157+
availability: see [docs/PACKAGING.md](docs/PACKAGING.md) for details.
150158

151159
## BUGS & SECURITY
152160

153-
See [SECURITY.md](SECURITY.md) for details on our security policy and
154-
[BUGS.md](BUGS.md) for reporting bugs.
161+
See [docs/SECURITY.md](docs/SECURITY.md) for details on our security policy and
162+
[docs/BUGS.md](docs/BUGS.md) for reporting bugs.

bash/journal

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# BASH COMPLETION SCRIPT FOR STANDARD_UNIX_NOTES journal(1)
2+
# Original PASSWORD_STORE version Copyright (C) 2012 - 2014 Jason A. Donenfeld <[email protected]> and
3+
# Brian Mattern <[email protected]>. All Rights Reserved.
4+
5+
# Installed into
6+
# /usr/share/bash-completion/completions/journal
7+
8+
9+
_journal_complete_entries () {
10+
if [ -n "$XDG_DATA_DIR" -a -z "$NOTESDIR" ] ; then
11+
# only use $XDG_DATA_DIR if NOTESDIR not set
12+
NOTESDIR="${XDG_DATA_DIR}/.notes"
13+
else
14+
# use NOTESDIR if set else default to ~/.notes
15+
NOTESDIR="${NOTESDIR:-${HOME}/.notes}"
16+
fi
17+
CONFIGFILE="${NOTESDIR}/config"
18+
INITIAL_NOTEBOOK="${NOTESDIR}/notes"
19+
DEFAULT_POINTER="${NOTESDIR}/DEFAULT"
20+
USE_POINTER="${NOTESDIR}/USE"
21+
JOURNALDIR="${NOTESDIR}/Journal"
22+
23+
24+
25+
26+
#fixup original password store code to search inside the Journal dir
27+
prefix="${JOURNALDIR}"
28+
29+
# code chunk below is fromthe original password store code
30+
prefix="${prefix%/}/"
31+
suffix=".gpg"
32+
autoexpand=${1:-0}
33+
34+
local IFS=$'\n'
35+
local items=($(compgen -f $prefix$cur))
36+
37+
# Remember the value of the first item, to see if it is a directory. If
38+
# it is a directory, then don't add a space to the completion
39+
local firstitem=""
40+
# Use counter, can't use ${#items[@]} as we skip hidden directories
41+
local i=0
42+
43+
for item in ${items[@]}; do
44+
[[ $item =~ /\.[^/]*$ ]] && continue
45+
46+
# if there is a unique match, and it is a directory with one entry
47+
# autocomplete the subentry as well (recursively)
48+
if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then
49+
while [[ -d $item ]]; do
50+
local subitems=($(compgen -f "$item/"))
51+
local filtereditems=( )
52+
for item2 in "${subitems[@]}"; do
53+
[[ $item2 =~ /\.[^/]*$ ]] && continue
54+
filtereditems+=( "$item2" )
55+
done
56+
if [[ ${#filtereditems[@]} -eq 1 ]]; then
57+
item="${filtereditems[0]}"
58+
else
59+
break
60+
fi
61+
done
62+
fi
63+
64+
# append / to directories
65+
[[ -d $item ]] && item="$item/"
66+
67+
item="${item%$suffix}"
68+
COMPREPLY+=("${item#$prefix}")
69+
if [[ $i -eq 0 ]]; then
70+
firstitem=$item
71+
fi
72+
let i+=1
73+
done
74+
75+
# The only time we want to add a space to the end is if there is only
76+
# one match, and it is not a directory
77+
if [[ $i -gt 1 || ( $i -eq 1 && -d $firstitem ) ]]; then
78+
compopt -o nospace
79+
fi
80+
}
81+
82+
83+
_journal_complete_keys () {
84+
local IFS=$'\n'
85+
local GPG=gpg2
86+
which $GPG >/dev/null || GPG=gpg
87+
# Extract names and email addresses from gpg --list-keys
88+
local keys="$($GPG --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')"
89+
COMPREPLY+=($(compgen -W "${keys}" -- ${cur}))
90+
}
91+
92+
_journal()
93+
{
94+
COMPREPLY=()
95+
local cur="${COMP_WORDS[COMP_CWORD]}"
96+
local commands="config newkey help version ls list show find search grep add insert view cat import rename mv copy cp rm remove delete edit ${UNIX_journal_EXTENSION_COMMANDS[*]}"
97+
if [[ $COMP_CWORD -gt 1 ]]; then
98+
local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
99+
case "${COMP_WORDS[1]}" in
100+
view|cat|edit|insert|add|cp|copy|mv|rename|rm|remove|delete)
101+
_journal_complete_entries
102+
;;
103+
import)
104+
;;
105+
*)
106+
;;
107+
esac
108+
109+
# To add completion for an extension command define a function like this:
110+
# __unix_journal_extension_complete_<COMMAND>() {
111+
# COMPREPLY+=($(compgen -W "-o --option" -- ${cur}))
112+
# _journal_complete_entries 1
113+
# }
114+
#
115+
# and add the command to the $UNIX_journal_EXTENSION_COMMANDS array
116+
if [[ " ${UNIX_journal_EXTENSION_COMMANDS[*]} " == *" ${COMP_WORDS[1]} "* ]] && type "__unix_journal_extension_complete_${COMP_WORDS[1]}" &> /dev/null; then
117+
"__unix_journal_extension_complete_${COMP_WORDS[1]}"
118+
fi
119+
else
120+
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
121+
# _journal_complete_entries 1
122+
fi
123+
}
124+
125+
126+
complete -o filenames -F _journal journal
127+

bash/notebook

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# BASH COMPLETION SCRIPT FOR STANDARD_UNIX_NOTES notes(1) notebook(1)
2+
# Original PASSWORD_STORE version Copyright (C) 2012 - 2014 Jason A. Donenfeld <[email protected]> and
3+
# Brian Mattern <[email protected]>. All Rights Reserved.
4+
5+
# Installed into
6+
# /usr/share/bash-completion/completions/notebook
7+
8+
9+
_notebook_complete_folders () {
10+
if [ -n "$XDG_DATA_DIR" -a -z "$NOTESDIR" ] ; then
11+
# only use $XDG_DATA_DIR if NOTESDIR not set
12+
NOTESDIR="${XDG_DATA_DIR}/.notes"
13+
else
14+
# use NOTESDIR if set else default to ~/.notes
15+
NOTESDIR="${NOTESDIR:-${HOME}/.notes}"
16+
fi
17+
CONFIGFILE="${NOTESDIR}/config"
18+
INITIAL_NOTEBOOK="${NOTESDIR}/notes"
19+
DEFAULT_POINTER="${NOTESDIR}/DEFAULT"
20+
USE_POINTER="${NOTESDIR}/USE"
21+
22+
prefix="${NOTESDIR}"
23+
prefix="${prefix%/}/"
24+
25+
local IFS=$'\n'
26+
local items=($(compgen -d $prefix$cur))
27+
for item in ${items[@]}; do
28+
29+
case "$item" in
30+
"$USE_POINTER")
31+
;;
32+
"$DEFAULT_POINTER")
33+
;;
34+
*)
35+
#[[ $item == $prefix.* ]] && continue
36+
COMPREPLY+=("${item#$prefix}/")
37+
;;
38+
esac
39+
done
40+
}
41+
42+
_notebook()
43+
{
44+
COMPREPLY=()
45+
local cur="${COMP_WORDS[COMP_CWORD]}"
46+
local commands="list ls show default use add insert rename mv copy cp delete rm remove ${UNIX_NOTES_EXTENSION_COMMANDS[*]}"
47+
if [[ $COMP_CWORD -gt 1 ]]; then
48+
local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
49+
case "${COMP_WORDS[1]}" in
50+
use|default|cp|copy|mv|rename|rm|remove|delete)
51+
_notebook_complete_folders
52+
;;
53+
esac
54+
55+
if [[ " ${UNIX_NOTES_EXTENSION_COMMANDS[*]} " == *" ${COMP_WORDS[1]} "* ]] && type "__unix_notes_extension_complete_${COMP_WORDS[1]}" &> /dev/null; then
56+
"__notes_extension_complete_${COMP_WORDS[1]}"
57+
fi
58+
else
59+
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
60+
fi
61+
}
62+
63+
complete -o filenames -F _notebook notebook
64+

bash-completions renamed to bash/notes

-56
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
# Installed into
66
# /usr/share/bash-completion/completions/notes
7-
# /usr/share/bash-completion/completions/notebook
87

98

109
_notes_complete_entries () {
@@ -76,39 +75,6 @@ _notes_complete_entries () {
7675
fi
7776
}
7877

79-
_notebook_complete_folders () {
80-
if [ -n "$XDG_DATA_DIR" -a -z "$NOTESDIR" ] ; then
81-
# only use $XDG_DATA_DIR if NOTESDIR not set
82-
NOTESDIR="${XDG_DATA_DIR}/.notes"
83-
else
84-
# use NOTESDIR if set else default to ~/.notes
85-
NOTESDIR="${NOTESDIR:-${HOME}/.notes}"
86-
fi
87-
CONFIGFILE="${NOTESDIR}/config"
88-
INITIAL_NOTEBOOK="${NOTESDIR}/notes"
89-
DEFAULT_POINTER="${NOTESDIR}/DEFAULT"
90-
USE_POINTER="${NOTESDIR}/USE"
91-
92-
prefix="${NOTESDIR}"
93-
prefix="${prefix%/}/"
94-
95-
local IFS=$'\n'
96-
local items=($(compgen -d $prefix$cur))
97-
for item in ${items[@]}; do
98-
99-
case "$item" in
100-
"$USE_POINTER")
101-
;;
102-
"$DEFAULT_POINTER")
103-
;;
104-
*)
105-
#[[ $item == $prefix.* ]] && continue
106-
COMPREPLY+=("${item#$prefix}/")
107-
;;
108-
esac
109-
done
110-
}
111-
11278
_notes_complete_keys () {
11379
local IFS=$'\n'
11480
local GPG=gpg2
@@ -151,27 +117,5 @@ _notes()
151117
fi
152118
}
153119

154-
_notebook()
155-
{
156-
COMPREPLY=()
157-
local cur="${COMP_WORDS[COMP_CWORD]}"
158-
local commands="list ls show default use add insert rename mv copy cp delete rm remove ${UNIX_NOTES_EXTENSION_COMMANDS[*]}"
159-
if [[ $COMP_CWORD -gt 1 ]]; then
160-
local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
161-
case "${COMP_WORDS[1]}" in
162-
use|default|cp|copy|mv|rename|rm|remove|delete)
163-
_notebook_complete_folders
164-
;;
165-
esac
166-
167-
if [[ " ${UNIX_NOTES_EXTENSION_COMMANDS[*]} " == *" ${COMP_WORDS[1]} "* ]] && type "__unix_notes_extension_complete_${COMP_WORDS[1]}" &> /dev/null; then
168-
"__notes_extension_complete_${COMP_WORDS[1]}"
169-
fi
170-
else
171-
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
172-
fi
173-
}
174-
175120
complete -o filenames -F _notes notes
176-
complete -o filenames -F _notebook notebook
177121

0 commit comments

Comments
 (0)