Skip to content

Commit 07667ce

Browse files
committed
Updated the Readme.
Bugfix on install.sh too. s Signed-off-by: primis <[email protected]>
1 parent df94117 commit 07667ce

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,13 @@ This is just one tool in the chain. `notes` is a command line tool, and some peo
2121

2222
## How do I install this?
2323

24-
Download `notes`, `chmod +x`, put it in your `$path`. This will probably do it:
2524

2625
```bash
27-
curl https://cdn.rawgit.com/pimterry/notes/v0.2.0/notes > /usr/local/bin/notes && chmod +x /usr/local/bin/notes
26+
curl https://cdn.rawgit.com/pimterry/notes/master/install.sh | bash
2827
```
2928

3029
By default your notes live in ~/notes, but you can change that to anywhere you like by setting the `$NOTES_DIRECTORY` environmental variable. See [how do I configure this?](#how-do-i-configure-this) for more details.
3130

32-
#### Installing Bash completion
33-
34-
`notes` includes bash autocompletion, to let you tab-complete commands and your note names. This requires Bash > 4.0 and [bash-completion](https://github.com/scop/bash-completion) to be installed - it's probably available from your friendly local package manager.
35-
36-
To enable completion for notes, copy the completion script into your bash completion directory, and it should be automatically loaded. The bash completion directory is `/usr/share/bash-completion/completions/` on a typical Debian install, or `/usr/local/etc/bash_completion.d/` on OSX with `bash-completion` from homebrew. You may be able to find your own bash completion directory by running the following command:
37-
38-
pkg-config --variable=completionsdir bash-completion
39-
40-
Installing the completions might be as follows:
41-
42-
```bash
43-
curl https://cdn.rawgit.com/pimterry/notes/v0.2.0/notes.bash_completion > /usr/share/bash-completion/completions/notes
44-
```
45-
46-
You'll need to open a new shell for this to take effect.
47-
4831
## How do I configure this?
4932

5033
To get started with you'll want to set `$EDITOR` to your favourite text editor, and probably `$NOTES_DIRECTORY` to the directory in which you'd like to use to store your notes (this defaults to `~/notes`). You'll typically want to set these as environment variables in your `.bashrc`, `.zshrc`, or similar.

install.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ function assertInstalled() {
1212
done
1313
}
1414

15-
# Pre-setup check for bash completion directory
16-
bash_completion_dir=`pkg-config --variable=completionsdir bash-completion` 2>/dev/null
17-
1815
# Yay, Echo self documents! :D
1916
echo "Checking for root..."
2017
[ "$(whoami)" != "root" ] && exec sudo -- "$0" "$@"
18+
# Get user's home directory so we can dum config later
19+
user_home=$(getent passwd $SUDO_USER | cut -d: -f6)
20+
2121

2222
echo "Checking for Dependencies..."
2323
assertInstalled bash curl tar
@@ -26,16 +26,19 @@ echo "Downloading and Extracting Notes from Repository..."
2626
extract_dir=$(mktemp -d)
2727
curl -L https://api.github.com/repos/pimterry/notes/tarball | tar -xzp -C $extract_dir --strip-components=1
2828

29+
# Pre-setup check for bash completion directory
30+
bash_completion_dir=`pkg-config --variable=completionsdir bash-completion` 2>/dev/null
31+
2932
echo "Moving Files into Place..."
30-
mv "$extract_dir"/notes /usr/local/bin/notes
33+
mv $extract_dir/notes /usr/local/bin/notes
3134
# Make it runnable
3235
chmod a+x /usr/local/bin/notes
3336
# Do we have bash completion abilities?
34-
if [ -d "$bash_completion_dir" ]; then
35-
mv "$extract_dir"/notes.bash_completion "$bash_completions_dir"/notes
37+
if [ -d $bash_completion_dir ]; then
38+
mv $extract_dir/notes.bash_completion $bash_completion_dir/notes
3639
fi
37-
mkdir -p ~/.config/notes/
38-
mv "$extract_dir"/config.example ~/.config/notes/config.example
40+
mkdir -p $user_home/.config/notes/
41+
mv $extract_dir/config.example $user_home/.config/notes/config.example
3942

4043
echo "Cleaning Up..."
4144
rm -rf $extract_dir

0 commit comments

Comments
 (0)