peter-notes 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -17
- data/bin/build +2 -0
- data/bin/console +6 -1
- data/bin/tag +3 -0
- data/lib/models/console_app.rb +14 -8
- data/lib/models/files/file_name.rb +19 -0
- data/lib/models/files/glob.rb +19 -0
- data/lib/models/files/note.rb +19 -0
- data/lib/models/note_book.rb +72 -0
- data/lib/models/preferences.rb +25 -16
- data/lib/peter_notes/peter_notes.rb +2 -2
- data/lib/peter_notes/version.rb +1 -1
- data/man/peter-notes.7 +40 -20
- data/man/peter-notes.7.html +32 -19
- data/man/peter-notes.7.ronn +36 -20
- data/peter-notes.gemspec +4 -4
- metadata +12 -7
- data/lib/models/notes.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2333410ef3df60574f570e9ca867b6c67a0e9889
|
4
|
+
data.tar.gz: cc801a8e486dc2a4db67e77daa9fbc16f297354d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ca451420b178b046adddb19cbf505d9943a97804317ae575fb70164b01e3b42adb3cce730daad35eeac27baf7b300e99da112a86d9673e6adc61c6104adee56
|
7
|
+
data.tar.gz: 53145632cbbf6ce9ea0b8f7e45a212910cc1002575ba2a78e2028d84023f9cd6564eea6126fdbaf7f0d9037f79864bafd40ca5f7f04a75b324d9158be26792ba
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# Peter Notes <a href="https://travis-ci.org/fonsecapeter/peter-notes"><img src="https://travis-ci.org/fonsecapeter/peter-notes.svg?branch=master"></img></a>
|
1
|
+
# Peter Notes [![Gem Version](https://badge.fury.io/rb/peter-notes.svg)](https://badge.fury.io/rb/peter-notes) <a href="https://travis-ci.org/fonsecapeter/peter-notes"><img src="https://travis-ci.org/fonsecapeter/peter-notes.svg?branch=master"></img></a>
|
2
2
|
|
3
|
-
Manage your notes from the console.
|
3
|
+
Manage your notes from the console.
|
4
4
|
|
5
|
-
If you're like me, you spend most of your computing time in a terminal
|
5
|
+
If you're like me, you spend most of your computing time in a terminal, you have a text-editor set up just to your liking, and you wish you could use it for everything. Naturally, when it comes time to ditch your paper note-pad, you refuse to to use the more popular gui-driven apps and want to find a way to use your editor instead.
|
6
6
|
|
7
|
-
But when you start looking for a
|
7
|
+
But when you start looking for a terminal-based notes framework (or plugin for your editor) you're blinded by crazy features and unwilling to learn a new tool. You've also already started keeping your notes in some text files and don't want to have to start over.
|
8
8
|
|
9
|
-
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them
|
9
|
+
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them and start using worlds simplest (and coolest) notes-manager.
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -31,28 +31,31 @@ Lets assume you have the following notes:
|
|
31
31
|
|
32
32
|
Most of the time you just want to open them. To do that, type `notes`. You can specify your text editor and where your notes are in `~/peter-notes.yaml` (see the preferences section below). This will basically `cd` into your notes and open them all with `YOUR-EDITOR ./`. Some editors don't super work when you open a directory, but I use vim with [NerdTree](https://github.com/scrooloose/nerdtree) and I'm sure other editors have similar plugins.
|
33
33
|
|
34
|
-
If you want to open a specific note, you can pass in a `file-glob` to specify which
|
34
|
+
If you want to open a specific note, you can pass in a `file-glob` to specify which one. If you think a file glob is what happens when you spill coffee on your computer, just check this out [this description](http://tldp.org/LDP/abs/html/globbingref.html) (hint, you use it in bash a lot, like, when you `ls *.rb`).
|
35
35
|
|
36
|
-
|
36
|
+
Lets say you want to open `other/motorcycle.txt`. You could run `notes "other/motorcycle.txt"`, but that's kind of lame, so you could also type `notes "motorcycle"`, or even `notes "moto*"`. If you're feeling extra crazy, you could get away with `m*` here. Basically if you pass a glob in, `peter-notes` will just take the first match from `--find` (see below) and open that. If you wanted to open all notes under `projects/` you could also use this same idea and run `notes "projects"`.
|
37
37
|
|
38
|
-
|
38
|
+
The close observer will have noticed that I'm leaving out `.txt` in most of my commands. That's not because `peter-notes` requires `.txt` files. In fact, you can use markdown or whatever kind of files you want, but `peter-notes` will totally ignore file extensions unless you provide one. If you plan on keeping most of your notes in some file-extension other than `.txt`, just add a line to your preferences file (below), but it really only effects `--new`.
|
39
39
|
|
40
40
|
That's like what 90% of what you'll ever need and no crazy macros or flags to memorize. Not bad right? Well not all flags are bad, in fact, you also get some super-helpful optional ones for the other 10%:
|
41
41
|
|
42
|
-
- `-s`, `--search REGEX`:
|
43
|
-
Search within notes for text matching the specified `REGEX`. This isn't magic, it's just [grep](http://linuxcommand.org/man_pages/grep1.html). Specifically, it's running `grep -r YOUR-NOTES-DIR -e REGEX`.
|
44
|
-
|
45
42
|
- `-f`, `--find FILE-GLOB`:
|
46
|
-
Seach for notes that match the specified
|
43
|
+
**Seach for notes that match the specified `FILE-GLOB`**. This one's running [find](http://linuxcommand.org/man_pages/find1.html) -- `find YOUR-NOTES-DIR -name FILE-GLOB`. It's a little more than that though, this will be fuzzy in that you can add some path info to your glob. For example, if you ran `notes --find "projects/*"` (or `notes --find "pro/*"`), you'd get back both `projects/python/jarbs.txt` and `projects/ruby/peter_notes.txt`. So it's better than just find. A little.
|
47
44
|
|
48
45
|
- `-l`, `--list [PATH]`:
|
49
|
-
List all notes or, if a `PATH` is specified, list notes within the specified path
|
46
|
+
**List all notes or, if a `PATH` is specified, list notes within the specified path**. Bet you thought this was running `ls -R`, well it's actually running [tree](http://linuxcommand.org/man_pages/tree1.html) because it's much cooler -- `tree YOUR-NOTES-DIR/PATH`.
|
47
|
+
|
48
|
+
- `-n`, `--new PATH`:
|
49
|
+
**Create a new note at the specified `PATH`, making any directories in-between, and open it**. If you don't give a file-type extension, `peter-notes` will use the `extension` value from your preferences (below), ex: `notes --new path/to/my_note` will make `~/Notes/path/to/my_note.txt` (with default preferences). If you do specify a file-type extension, you'll create a note with that extension -- they don't all have to be the same! :astonished:
|
50
|
+
|
51
|
+
- `-s`, `--search REGEX`:
|
52
|
+
**Search within notes for text matching the specified `REGEX`**, ex: `notes --search ".*TODO.*"`. This isn't magic, it's just [grep](http://linuxcommand.org/man_pages/grep1.html). Specifically, it's running `grep -r YOUR-NOTES-DIR -e REGEX`.
|
50
53
|
|
51
54
|
Oh yeah, make sure your terminal has `grep`, `find`, and `tree`. It should, but depends on how crazy your 'gear' is. Also, this is a cli tool, don't try to import it into some ruby source code.
|
52
55
|
|
53
56
|
## Preferences
|
54
57
|
|
55
|
-
Preferences are saved in `~/.peter-notes.yml`. There are just
|
58
|
+
Preferences are saved in `~/.peter-notes.yml`. There are just 3 options that you can set so don't freak out:
|
56
59
|
|
57
60
|
- `editor`:
|
58
61
|
The editor of your choice. This value will get passed to bash so make sure you use the exact name your terminal will understand.
|
@@ -65,15 +68,23 @@ Preferences are saved in `~/.peter-notes.yml`. There are just 2 options that you
|
|
65
68
|
- `notes_dir`:
|
66
69
|
The home of your notes. This is where `notes` will look for them.
|
67
70
|
|
68
|
-
**Possible Values**: any valid + existing dorectory path. I use `~/GoogleDrive/Notes` because I track mine in google drive (
|
71
|
+
**Possible Values**: any valid + existing dorectory path. I use `~/GoogleDrive/Notes` because I track mine in google drive ([overGrive](https://www.thefanclub.co.za/overgrive) for linux).
|
69
72
|
|
70
73
|
**Default Value**: `~/Notes`
|
71
74
|
|
75
|
+
- `extension`:
|
76
|
+
The default file-type extension for your notes.
|
77
|
+
|
78
|
+
**Possible Values**: `[txt, md, yml, json, html, rb, ...]` anything your editor can understand that's a valid file extension.
|
79
|
+
|
80
|
+
**Default Value**: `txt`
|
81
|
+
|
72
82
|
That's [yaml](http://www.yaml.org/start.html) so it should look like this:
|
73
83
|
|
74
84
|
```yaml
|
75
85
|
editor: vim
|
76
|
-
notes_dir:
|
86
|
+
notes_dir: ~/Notes
|
87
|
+
extension: txt
|
77
88
|
```
|
78
89
|
|
79
90
|
## Development
|
@@ -84,7 +95,7 @@ If you're changing the man page, generate roff and html files with `bin/ronn`.
|
|
84
95
|
|
85
96
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
86
97
|
|
87
|
-
To release a new version, first update the version number in `lib/peter_notes/version.rb`, then build the gem with `bundle exec rake build`. Now you can
|
98
|
+
To release a new version, first update the version number in `lib/peter_notes/version.rb`, then build the gem with `bundle exec rake build`. Install locally and confirm nothing broke, push a commit [Major, Minor, Patch] version bump. Now you can push the `.gem` file to [rubygems.org](https://rubygems.org) with `gem push pkg/peter-notes-VERSION.gem`. Throw a git tag on there `bin/tag`.
|
88
99
|
|
89
100
|
## Contributing
|
90
101
|
|
data/bin/build
ADDED
data/bin/console
CHANGED
@@ -2,8 +2,13 @@
|
|
2
2
|
|
3
3
|
require "pry"
|
4
4
|
require "bundler/setup"
|
5
|
+
|
6
|
+
require "models/files/file_name"
|
7
|
+
require "models/files/glob"
|
8
|
+
require "models/files/note"
|
9
|
+
|
5
10
|
require "models/console_app"
|
6
|
-
require "models/
|
11
|
+
require "models/note_book"
|
7
12
|
require "models/preferences"
|
8
13
|
|
9
14
|
Pry.start
|
data/bin/tag
ADDED
data/lib/models/console_app.rb
CHANGED
@@ -9,24 +9,30 @@ class ConsoleApp
|
|
9
9
|
opts.separator('')
|
10
10
|
opts.separator('Options:')
|
11
11
|
opts.separator(' [FILE-GLOB] Open the first file that matches FILE-GLOB if supplied')
|
12
|
-
opts.on('-s', '--search REGEX', 'Search within notes') do |regex|
|
13
|
-
self.search(regex)
|
14
|
-
exit(0)
|
15
|
-
end
|
16
12
|
opts.on('-f', '--find FILE-GLOB', 'Find notes that fuzzily match FILE-GLOB') do |glob|
|
17
|
-
puts(
|
13
|
+
puts(find(glob))
|
18
14
|
exit(0)
|
19
15
|
end
|
20
16
|
opts.on('-l', '--list [PATH]', 'List all notes', ' (list notes under PATH if supplied)') do |path|
|
21
|
-
|
17
|
+
list(path)
|
18
|
+
exit(0)
|
19
|
+
end
|
20
|
+
opts.on('-n', '--new PATH', 'Create new note at PATH') do |path|
|
21
|
+
new_note(path)
|
22
|
+
open_notes(path)
|
22
23
|
exit(0)
|
23
24
|
end
|
25
|
+
opts.on('-s', '--search REGEX', 'Search within notes') do |regex|
|
26
|
+
search(regex)
|
27
|
+
exit(0)
|
28
|
+
end
|
29
|
+
opts.separator('')
|
24
30
|
opts.on('-h', '--help', 'Show this message') do
|
25
31
|
puts(opts)
|
26
32
|
exit(0)
|
27
33
|
end
|
28
34
|
opts.on('-v', '--version', 'Show version') do
|
29
|
-
puts(
|
35
|
+
puts(version)
|
30
36
|
exit(0)
|
31
37
|
end
|
32
38
|
opts.separator('')
|
@@ -42,6 +48,6 @@ class ConsoleApp
|
|
42
48
|
puts(options)
|
43
49
|
exit(1)
|
44
50
|
end
|
45
|
-
|
51
|
+
on_run(arg)
|
46
52
|
end
|
47
53
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class FileName
|
2
|
+
attr_reader :path, :dirname, :filename
|
3
|
+
def initialize(path)
|
4
|
+
@path = path
|
5
|
+
@dirname, @filename = File.split(path)
|
6
|
+
end
|
7
|
+
|
8
|
+
def extname
|
9
|
+
File.extname(@filename)
|
10
|
+
end
|
11
|
+
|
12
|
+
def name
|
13
|
+
File.basename(@filename, '.*')
|
14
|
+
end
|
15
|
+
|
16
|
+
def no_dir?
|
17
|
+
return @dirname == '.'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'models/files/file_name'
|
2
|
+
|
3
|
+
class Glob < FileName
|
4
|
+
def fuzzified
|
5
|
+
return fuzzy_dir, fuzzy_name
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def fuzzy_dir
|
11
|
+
return nil if no_dir?
|
12
|
+
return @dirname.gsub(File::SEPARATOR, '.*')
|
13
|
+
end
|
14
|
+
|
15
|
+
def fuzzy_name
|
16
|
+
return "#{name}.*" if extname.empty?
|
17
|
+
return filename
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'models/files/file_name'
|
3
|
+
|
4
|
+
class Note < FileName
|
5
|
+
def self.touch(path)
|
6
|
+
note = new(path)
|
7
|
+
FileUtils.makedirs(note.dirname)
|
8
|
+
FileUtils.touch(note.path)
|
9
|
+
return note
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(path)
|
13
|
+
super
|
14
|
+
unless no_dir?
|
15
|
+
@dirname = File.expand_path(@dirname)
|
16
|
+
@path = File.expand_path(@path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'models/files/glob'
|
2
|
+
require 'models/files/note'
|
3
|
+
|
4
|
+
require 'models/console_app'
|
5
|
+
require 'models/preferences'
|
6
|
+
require 'peter_notes/version'
|
7
|
+
|
8
|
+
class NoteBook < ConsoleApp
|
9
|
+
attr_reader :preferences
|
10
|
+
|
11
|
+
def initialize(prefs)
|
12
|
+
@preferences = prefs
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(path)
|
16
|
+
path = path || ''
|
17
|
+
notes_path = File.join(@preferences.notes_dir, path)
|
18
|
+
system("tree #{notes_path}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def search(regex)
|
22
|
+
system("grep --color=always -r #{@preferences.notes_dir} -e #{regex}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def new_note(path)
|
26
|
+
full_path = File.join(@preferences.notes_dir, path)
|
27
|
+
full_path += '.' + @preferences.extension if File.extname(full_path).empty?
|
28
|
+
Note.touch(full_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def find(glob)
|
32
|
+
return [] if glob.nil? || glob.empty?
|
33
|
+
cmd = find_commandify(glob)
|
34
|
+
found = `#{cmd}`
|
35
|
+
return found.nil? ? found : found.split
|
36
|
+
end
|
37
|
+
|
38
|
+
def open_notes(glob)
|
39
|
+
enter_dir!
|
40
|
+
found = find(glob)[0]
|
41
|
+
found = './' if found.nil?
|
42
|
+
system("#{@preferences.editor} #{found}")
|
43
|
+
leave_dir!
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_run(glob)
|
47
|
+
open_notes(glob)
|
48
|
+
end
|
49
|
+
|
50
|
+
def version
|
51
|
+
return PeterNotes::VERSION
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def enter_dir!
|
57
|
+
@cur_dir = Dir.pwd
|
58
|
+
Dir.chdir(@preferences.notes_dir)
|
59
|
+
end
|
60
|
+
|
61
|
+
def leave_dir!
|
62
|
+
Dir.chdir(@cur_dir)
|
63
|
+
end
|
64
|
+
|
65
|
+
def find_commandify(glob)
|
66
|
+
glob = Glob.new(glob)
|
67
|
+
glob_path, glob_file = glob.fuzzified
|
68
|
+
cmd = "find \"#{@preferences.notes_dir}\" -name \"#{glob_file}\""
|
69
|
+
cmd += " | grep -e \"#{glob_path}\"" unless glob_path.nil?
|
70
|
+
return cmd
|
71
|
+
end
|
72
|
+
end
|
data/lib/models/preferences.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
class Preferences
|
4
|
-
attr_reader :
|
4
|
+
attr_reader :preferences
|
5
5
|
|
6
|
-
@@
|
7
|
-
@@defaults = {
|
6
|
+
@@primary_defaults = {
|
8
7
|
editor: 'vim',
|
9
|
-
notes_dir:
|
8
|
+
notes_dir: File.expand_path('~/Notes')
|
10
9
|
}
|
11
|
-
@@
|
10
|
+
@@aux_defaults = {
|
11
|
+
extension: 'txt'
|
12
|
+
}
|
13
|
+
@@defaults = @@aux_defaults.merge(@@primary_defaults)
|
14
|
+
@@prefs_file = File.expand_path('~/.peter-notes.yml')
|
12
15
|
|
13
16
|
def self.defaults
|
14
17
|
@@defaults
|
@@ -19,20 +22,22 @@ class Preferences
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def self.defaults_yaml
|
22
|
-
@@
|
25
|
+
@@primary_defaults.to_yaml
|
23
26
|
end
|
24
27
|
|
25
28
|
def initialize(prefs=nil)
|
26
|
-
@preferences = prefs
|
27
|
-
@preferences[:notes_dir] = File.expand_path(@preferences[:notes_dir])
|
28
|
-
@editor = @preferences[:editor]
|
29
|
-
@notes_dir = @preferences[:notes_dir]
|
29
|
+
@preferences = load_preferences(prefs)
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.write_yaml_defaults
|
33
33
|
File.write(@@prefs_file, self.defaults_yaml)
|
34
34
|
end
|
35
35
|
|
36
|
+
def method_missing(attribute)
|
37
|
+
return @preferences[attribute] if @preferences.has_key?(attribute)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
36
41
|
private
|
37
42
|
|
38
43
|
def load_yaml_preferences
|
@@ -45,12 +50,16 @@ class Preferences
|
|
45
50
|
)
|
46
51
|
end
|
47
52
|
|
48
|
-
def load_preferences
|
49
|
-
if
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
def load_preferences(prefs)
|
54
|
+
if prefs.nil?
|
55
|
+
if File.exists?(@@prefs_file)
|
56
|
+
prefs = load_yaml_preferences
|
57
|
+
else
|
58
|
+
prefs = @@defaults
|
59
|
+
end
|
54
60
|
end
|
61
|
+
merged_prefs = @@defaults.merge(prefs)
|
62
|
+
merged_prefs[:notes_dir] = File.expand_path(merged_prefs[:notes_dir])
|
63
|
+
return merged_prefs
|
55
64
|
end
|
56
65
|
end
|
data/lib/peter_notes/version.rb
CHANGED
data/man/peter-notes.7
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "PETER\-NOTES" "1" "
|
4
|
+
.TH "PETER\-NOTES" "1" "July 2017" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpeter\-notes\fR \- manage your notes from the terminal
|
@@ -21,22 +21,35 @@
|
|
21
21
|
.br
|
22
22
|
.
|
23
23
|
.SH "DESCRIPTION"
|
24
|
-
|
24
|
+
Manage your notes from the console\.
|
25
|
+
.
|
26
|
+
.P
|
27
|
+
If you\'re like me, you spend most of your computing time in a terminal, you have a text\-editor set up just to your liking, and you wish you could use it for everything\. Naturally, when it comes time to ditch your paper note\-pad, you refuse to to use the more popular gui\-driven apps and want to find a way to use your editor instead\.
|
28
|
+
.
|
29
|
+
.P
|
30
|
+
But when you start looking for a terminal\-based notes framework (or plugin for your editor) you\'re blinded by crazy features and unwilling to learn a new tool\. You\'ve also already started keeping your notes in some text files and don\'t want to have to start over\.
|
31
|
+
.
|
32
|
+
.P
|
33
|
+
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn\'t a lot\. But, like ruby, it has a nice interface, and it\'ll stay out of the way\. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them\. So if you already have your own notes, you can just point \fBpeter\-notes\fR at them and start using worlds simplest (and coolest) notes\-manager\.
|
25
34
|
.
|
26
35
|
.SH "OPTIONS"
|
27
36
|
These options provide some extra utility beyond simply opening notes for editing\.
|
28
37
|
.
|
29
38
|
.TP
|
30
|
-
\fB\-
|
31
|
-
|
39
|
+
\fB\-f\fR, \fB\-\-find FILE\-GLOB\fR
|
40
|
+
Seach for notes that match the specified \fBFILE\-GLOB\fR\. This one\'s running find \fIhttp://linuxcommand\.org/man_pages/find1\.html\fR \-\- \fBfind YOUR\-NOTES\-DIR \-name FILE\-GLOB\fR\. It\'s a little more than that though, this will be fuzzy in that you can add some path info to your glob\. For example, if you ran \fBnotes \-\-find "projects/*"\fR (or \fBnotes \-\-find "pro/*"\fR), you\'d get back both \fBprojects/python/jarbs\.txt\fR and \fBprojects/ruby/peter_notes\.txt\fR\. So it\'s better than just find\. A little\.
|
41
|
+
.
|
42
|
+
.TP
|
43
|
+
\fB\-l\fR, \fB\-\-list [PATH]\fR
|
44
|
+
List all notes or, if a \fBPATH\fR is specified, list notes within the specified path\. Bet you thought this was running \fBls \-R\fR, well it\'s actually running tree \fIhttp://linuxcommand\.org/man_pages/tree1\.html\fR because it\'s much cooler \-\- \fBtree YOUR\-NOTES\-DIR/PATH\fR\.
|
32
45
|
.
|
33
46
|
.TP
|
34
|
-
\fB\-
|
35
|
-
|
47
|
+
\fB\-n\fR, \fB\-\-new PATH\fR
|
48
|
+
Create a new note at the specified \fBPATH\fR, making any directories in\-between, and open it\. If you don\'t give a file\-type extension, \fBpeter\-notes\fR will use the \fBextension\fR value from your preferences (below), ex: \fBnotes \-\-new path/to/my_note\fR will make \fB~/Notes/path/to/my_note\.txt\fR (with default preferences)\. If you do specify a file\-type extension, you\'ll create a note with that extension \-\- they don\'t all have to be the same! :astonished:
|
36
49
|
.
|
37
50
|
.TP
|
38
|
-
\fB\-
|
39
|
-
|
51
|
+
\fB\-s\fR, \fB\-\-search REGEX\fR
|
52
|
+
\fBSearch within notes for text matching the specified \fBREGEX\fR\fR, ex: \fBnotes \-\-search "\.*TODO\.*"\fR\. This isn\'t magic, it\'s just grep \fIhttp://linuxcommand\.org/man_pages/grep1\.html\fR\. Specifically, it\'s running \fBgrep \-r YOUR\-NOTES\-DIR \-e REGEX\fR\.
|
40
53
|
.
|
41
54
|
.SH "EXAMPLES"
|
42
55
|
\fBnotes\fR\. Yeah\.
|
@@ -65,16 +78,16 @@ Lets assume you have the following notes:
|
|
65
78
|
.IP "" 0
|
66
79
|
.
|
67
80
|
.P
|
68
|
-
Most of the time you just want to open them\. To do that,
|
81
|
+
Most of the time you just want to open them\. To do that, type \fBnotes\fR\. You can specify your text editor and where your notes are in \fB~/peter\-notes\.yaml\fR (see PREFERENCES below)\. This will basically \fBcd\fR into your notes and open them all with \fBYOUR\-EDITOR \./\fR\. Some editors don\'t super work when you open a directory, but I use vim with NerdTree \fIhttps://github\.com/scrooloose/nerdtree\fR and I\'m sure other editors have similar plugins\.
|
69
82
|
.
|
70
83
|
.P
|
71
|
-
If you want to open a specific note, you can pass in a \fBfile\-glob\fR to specify which
|
84
|
+
If you want to open a specific note, you can pass in a \fBfile\-glob\fR to specify which one\. If you think a file glob is what happens when you spill coffee on your computer, just check this out this description \fIhttp://tldp\.org/LDP/abs/html/globbingref\.html\fR (hint, you use it in bash a lot, like, when you \fBls *\.rb\fR)\.
|
72
85
|
.
|
73
86
|
.P
|
74
|
-
|
87
|
+
Lets say you want to open \fBother/motorcycle\.txt\fR\. You could run \fBnotes "other/motorcycle\.txt"\fR, but that\'s kind of lame, so you could also type \fBnotes "motorcycle"\fR, or even \fBnotes "moto*"\fR\. If you\'re feeling extra crazy, you could get away with \fBm*\fR here\. Basically if you pass a glob in, \fBpeter\-notes\fR will just take the first match from \fB\-\-find\fR (see OPTIONS above) and open that\. If you wanted to open all notes under \fBprojects/\fR you could also use this same idea and run \fBnotes "projects"\fR\.
|
75
88
|
.
|
76
89
|
.P
|
77
|
-
|
90
|
+
The close observer will have noticed that I\'m leaving out \fB\.txt\fR in most of my commands\. That\'s not because \fBpeter\-notes\fR requires \fB\.txt\fR files\. In fact, you can use markdown or whatever kind of files you want, but \fBpeter\-notes\fR will totally ignore file extensions unless you provide one\. If you plan on keeping most of your notes in some file\-extension other than \fB\.txt\fR, just add a line to your preferences file (below), but it really only effects \fB\-\-new\fR\.
|
78
91
|
.
|
79
92
|
.P
|
80
93
|
Thats like what 90% of what youll ever need and no crazy macros or flags to memorize\. Not bad right? Well not all flags are bad, in fact, you also get some super\-helpful optional ones for the other 10%, just look above at the OPTIONS section\.
|
@@ -92,19 +105,25 @@ Preferences are saved in \'~/\.peter\-notes\.yml\'\. There are just 2 options th
|
|
92
105
|
editor:
|
93
106
|
The editor of your choice\. This value will get passed to bash so
|
94
107
|
make sure you use the exact name your terminal will understand\.
|
95
|
-
Possible Values: [
|
96
|
-
(more?) I haven\'t tested others
|
97
|
-
|
98
|
-
|
99
|
-
Default Value: \'vim\'
|
108
|
+
Possible Values: [vim, subl, atom, emacs, nano, \.\.\.]
|
109
|
+
(more?) I haven\'t tested others but I know
|
110
|
+
they\'re out there\.
|
111
|
+
Default Value: vim
|
100
112
|
|
101
113
|
notes_dir:
|
102
114
|
The home of your notes\. This is where `peter\-notes` will look
|
103
115
|
for them\.
|
104
116
|
Possible Values: any valid + existing dorectory path\. I use
|
105
|
-
|
117
|
+
~/GoogleDrive/Notes because I track mine in
|
106
118
|
google drive (OverGrive for linux)\.
|
107
|
-
Default Value:
|
119
|
+
Default Value: ~/Notes
|
120
|
+
|
121
|
+
extension:
|
122
|
+
The default file\-type extension for your notes\.
|
123
|
+
Possible Values: [txt, md, yml, json, html, rb, \.\.\.]
|
124
|
+
anything your editor can understand that\'s a
|
125
|
+
valid file extension\.
|
126
|
+
Default Value: txt
|
108
127
|
.
|
109
128
|
.fi
|
110
129
|
.
|
@@ -118,7 +137,8 @@ That\'s yaml \fIhttp://www\.yaml\.org/start\.html\fR so it should look like this
|
|
118
137
|
.nf
|
119
138
|
|
120
139
|
editor: vim
|
121
|
-
notes_dir:
|
140
|
+
notes_dir: ~/Notes
|
141
|
+
extension: txt
|
122
142
|
.
|
123
143
|
.fi
|
124
144
|
.
|
data/man/peter-notes.7.html
CHANGED
@@ -83,8 +83,13 @@
|
|
83
83
|
|
84
84
|
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
85
85
|
|
86
|
-
<p>
|
87
|
-
|
86
|
+
<p>Manage your notes from the console.</p>
|
87
|
+
|
88
|
+
<p>If you're like me, you spend most of your computing time in a terminal, you have a text-editor set up just to your liking, and you wish you could use it for everything. Naturally, when it comes time to ditch your paper note-pad, you refuse to to use the more popular gui-driven apps and want to find a way to use your editor instead.</p>
|
89
|
+
|
90
|
+
<p>But when you start looking for a terminal-based notes framework (or plugin for your editor) you're blinded by crazy features and unwilling to learn a new tool. You've also already started keeping your notes in some text files and don't want to have to start over.</p>
|
91
|
+
|
92
|
+
<p>Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point <code>peter-notes</code> at them and start using worlds simplest (and coolest) notes-manager.</p>
|
88
93
|
|
89
94
|
<h2 id="OPTIONS">OPTIONS</h2>
|
90
95
|
|
@@ -92,9 +97,10 @@ gem is an awesome way to manage personal notes from the terminal.</p>
|
|
92
97
|
for editing.</p>
|
93
98
|
|
94
99
|
<dl>
|
95
|
-
<dt><code>-
|
96
|
-
<dt><code>-
|
97
|
-
<dt><code>-
|
100
|
+
<dt><code>-f</code>, <code>--find FILE-GLOB</code></dt><dd><p>Seach for notes that match the specified <code>FILE-GLOB</code>. This one's running <a href="http://linuxcommand.org/man_pages/find1.html">find</a> -- <code>find YOUR-NOTES-DIR -name FILE-GLOB</code>. It's a little more than that though, this will be fuzzy in that you can add some path info to your glob. For example, if you ran <code>notes --find "projects/*"</code> (or <code>notes --find "pro/*"</code>), you'd get back both <code>projects/python/jarbs.txt</code> and <code>projects/ruby/peter_notes.txt</code>. So it's better than just find. A little.</p></dd>
|
101
|
+
<dt><code>-l</code>, <code>--list [PATH]</code></dt><dd><p>List all notes or, if a <code>PATH</code> is specified, list notes within the specified path. Bet you thought this was running <code>ls -R</code>, well it's actually running <a href="http://linuxcommand.org/man_pages/tree1.html">tree</a> because it's much cooler -- <code>tree YOUR-NOTES-DIR/PATH</code>.</p></dd>
|
102
|
+
<dt><code>-n</code>, <code>--new PATH</code></dt><dd><p>Create a new note at the specified <code>PATH</code>, making any directories in-between, and open it. If you don't give a file-type extension, <code>peter-notes</code> will use the <code>extension</code> value from your preferences (below), ex: <code>notes --new path/to/my_note</code> will make <code>~/Notes/path/to/my_note.txt</code> (with default preferences). If you do specify a file-type extension, you'll create a note with that extension -- they don't all have to be the same! :astonished:</p></dd>
|
103
|
+
<dt><code>-s</code>, <code>--search REGEX</code></dt><dd><p><strong>Search within notes for text matching the specified <code>REGEX</code></strong>, ex: <code>notes --search ".*TODO.*"</code>. This isn't magic, it's just <a href="http://linuxcommand.org/man_pages/grep1.html">grep</a>. Specifically, it's running <code>grep -r YOUR-NOTES-DIR -e REGEX</code>.</p></dd>
|
98
104
|
</dl>
|
99
105
|
|
100
106
|
|
@@ -116,13 +122,13 @@ for editing.</p>
|
|
116
122
|
+-- motorcycle.txt
|
117
123
|
</code></pre>
|
118
124
|
|
119
|
-
<p>Most of the time you just want to open them. To do that,
|
125
|
+
<p>Most of the time you just want to open them. To do that, type <code>notes</code>. You can specify your text editor and where your notes are in <code>~/peter-notes.yaml</code> (see PREFERENCES below). This will basically <code>cd</code> into your notes and open them all with <code>YOUR-EDITOR ./</code>. Some editors don't super work when you open a directory, but I use vim with <a href="https://github.com/scrooloose/nerdtree">NerdTree</a> and I'm sure other editors have similar plugins.</p>
|
120
126
|
|
121
|
-
<p>If you want to open a specific note, you can pass in a <code>file-glob</code> to specify which
|
127
|
+
<p>If you want to open a specific note, you can pass in a <code>file-glob</code> to specify which one. If you think a file glob is what happens when you spill coffee on your computer, just check this out <a href="http://tldp.org/LDP/abs/html/globbingref.html">this description</a> (hint, you use it in bash a lot, like, when you <code>ls *.rb</code>).</p>
|
122
128
|
|
123
|
-
<p>
|
129
|
+
<p>Lets say you want to open <code>other/motorcycle.txt</code>. You could run <code>notes "other/motorcycle.txt"</code>, but that's kind of lame, so you could also type <code>notes "motorcycle"</code>, or even <code>notes "moto*"</code>. If you're feeling extra crazy, you could get away with <code>m*</code> here. Basically if you pass a glob in, <code>peter-notes</code> will just take the first match from <code>--find</code> (see OPTIONS above) and open that. If you wanted to open all notes under <code>projects/</code> you could also use this same idea and run <code>notes "projects"</code>.</p>
|
124
130
|
|
125
|
-
<p>
|
131
|
+
<p>The close observer will have noticed that I'm leaving out <code>.txt</code> in most of my commands. That's not because <code>peter-notes</code> requires <code>.txt</code> files. In fact, you can use markdown or whatever kind of files you want, but <code>peter-notes</code> will totally ignore file extensions unless you provide one. If you plan on keeping most of your notes in some file-extension other than <code>.txt</code>, just add a line to your preferences file (below), but it really only effects <code>--new</code>.</p>
|
126
132
|
|
127
133
|
<p>Thats like what 90% of what youll ever need and no crazy macros or flags to memorize. Not bad right? Well not all flags are bad, in fact, you also get some super-helpful optional ones for the other 10%, just look above at the OPTIONS section.</p>
|
128
134
|
|
@@ -136,30 +142,37 @@ options that you can set:</p>
|
|
136
142
|
<pre><code>editor:
|
137
143
|
The editor of your choice. This value will get passed to bash so
|
138
144
|
make sure you use the exact name your terminal will understand.
|
139
|
-
Possible Values: [
|
140
|
-
(more?) I haven't tested others
|
141
|
-
|
142
|
-
|
143
|
-
Default Value: 'vim'
|
145
|
+
Possible Values: [vim, subl, atom, emacs, nano, ...]
|
146
|
+
(more?) I haven't tested others but I know
|
147
|
+
they're out there.
|
148
|
+
Default Value: vim
|
144
149
|
|
145
150
|
notes_dir:
|
146
151
|
The home of your notes. This is where `peter-notes` will look
|
147
152
|
for them.
|
148
153
|
Possible Values: any valid + existing dorectory path. I use
|
149
|
-
|
154
|
+
~/GoogleDrive/Notes because I track mine in
|
150
155
|
google drive (OverGrive for linux).
|
151
|
-
Default Value:
|
156
|
+
Default Value: ~/Notes
|
157
|
+
|
158
|
+
extension:
|
159
|
+
The default file-type extension for your notes.
|
160
|
+
Possible Values: [txt, md, yml, json, html, rb, ...]
|
161
|
+
anything your editor can understand that's a
|
162
|
+
valid file extension.
|
163
|
+
Default Value: txt
|
152
164
|
</code></pre>
|
153
165
|
|
154
166
|
<p>That's <a href="http://www.yaml.org/start.html">yaml</a> so it should look like this:</p>
|
155
167
|
|
156
168
|
<pre><code>editor: vim
|
157
|
-
notes_dir:
|
169
|
+
notes_dir: ~/Notes
|
170
|
+
extension: txt
|
158
171
|
</code></pre>
|
159
172
|
|
160
173
|
<h2 id="AUTHORS">AUTHORS</h2>
|
161
174
|
|
162
|
-
<p>Peter Fonseca <a href="&#
|
175
|
+
<p>Peter Fonseca <a href="mailto:peter.nfonseca@gmail.com" data-bare-link="true">peter.nfonseca@gmail.com</a></p>
|
163
176
|
|
164
177
|
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
165
178
|
|
@@ -172,7 +185,7 @@ fantastic language called ruby.</p>
|
|
172
185
|
|
173
186
|
<ol class='man-decor man-foot man foot'>
|
174
187
|
<li class='tl'></li>
|
175
|
-
<li class='tc'>
|
188
|
+
<li class='tc'>July 2017</li>
|
176
189
|
<li class='tr'>peter-notes(1)</li>
|
177
190
|
</ol>
|
178
191
|
|
data/man/peter-notes.7.ronn
CHANGED
@@ -10,23 +10,30 @@ peter-notes(1) -- manage your notes from the terminal
|
|
10
10
|
|
11
11
|
## DESCRIPTION
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
Manage your notes from the console.
|
14
|
+
|
15
|
+
If you're like me, you spend most of your computing time in a terminal, you have a text-editor set up just to your liking, and you wish you could use it for everything. Naturally, when it comes time to ditch your paper note-pad, you refuse to to use the more popular gui-driven apps and want to find a way to use your editor instead.
|
16
|
+
|
17
|
+
But when you start looking for a terminal-based notes framework (or plugin for your editor) you're blinded by crazy features and unwilling to learn a new tool. You've also already started keeping your notes in some text files and don't want to have to start over.
|
18
|
+
|
19
|
+
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them and start using worlds simplest (and coolest) notes-manager.
|
15
20
|
|
16
21
|
## OPTIONS
|
17
22
|
|
18
23
|
These options provide some extra utility beyond simply opening notes
|
19
24
|
for editing.
|
20
25
|
|
21
|
-
* `-
|
22
|
-
|
26
|
+
* `-f`, `--find FILE-GLOB`:
|
27
|
+
Seach for notes that match the specified `FILE-GLOB`. This one's running [find](http://linuxcommand.org/man_pages/find1.html) -- `find YOUR-NOTES-DIR -name FILE-GLOB`. It's a little more than that though, this will be fuzzy in that you can add some path info to your glob. For example, if you ran `notes --find "projects/*"` (or `notes --find "pro/*"`), you'd get back both `projects/python/jarbs.txt` and `projects/ruby/peter_notes.txt`. So it's better than just find. A little.
|
23
28
|
|
24
|
-
* `-
|
25
|
-
|
29
|
+
* `-l`, `--list [PATH]`:
|
30
|
+
List all notes or, if a `PATH` is specified, list notes within the specified path. Bet you thought this was running `ls -R`, well it's actually running [tree](http://linuxcommand.org/man_pages/tree1.html) because it's much cooler -- `tree YOUR-NOTES-DIR/PATH`.
|
26
31
|
|
32
|
+
* `-n`, `--new PATH`:
|
33
|
+
Create a new note at the specified `PATH`, making any directories in-between, and open it. If you don't give a file-type extension, `peter-notes` will use the `extension` value from your preferences (below), ex: `notes --new path/to/my_note` will make `~/Notes/path/to/my_note.txt` (with default preferences). If you do specify a file-type extension, you'll create a note with that extension -- they don't all have to be the same! :astonished:
|
27
34
|
|
28
|
-
|
29
|
-
|
35
|
+
- `-s`, `--search REGEX`:
|
36
|
+
**Search within notes for text matching the specified `REGEX`**, ex: `notes --search ".*TODO.*"`. This isn't magic, it's just [grep](http://linuxcommand.org/man_pages/grep1.html). Specifically, it's running `grep -r YOUR-NOTES-DIR -e REGEX`.
|
30
37
|
|
31
38
|
|
32
39
|
## EXAMPLES
|
@@ -46,13 +53,13 @@ Lets assume you have the following notes:
|
|
46
53
|
+-- other
|
47
54
|
+-- motorcycle.txt
|
48
55
|
|
49
|
-
Most of the time you just want to open them. To do that,
|
56
|
+
Most of the time you just want to open them. To do that, type `notes`. You can specify your text editor and where your notes are in `~/peter-notes.yaml` (see PREFERENCES below). This will basically `cd` into your notes and open them all with `YOUR-EDITOR ./`. Some editors don't super work when you open a directory, but I use vim with [NerdTree](https://github.com/scrooloose/nerdtree) and I'm sure other editors have similar plugins.
|
50
57
|
|
51
|
-
If you want to open a specific note, you can pass in a `file-glob` to specify which
|
58
|
+
If you want to open a specific note, you can pass in a `file-glob` to specify which one. If you think a file glob is what happens when you spill coffee on your computer, just check this out [this description](http://tldp.org/LDP/abs/html/globbingref.html) (hint, you use it in bash a lot, like, when you `ls *.rb`).
|
52
59
|
|
53
|
-
|
60
|
+
Lets say you want to open `other/motorcycle.txt`. You could run `notes "other/motorcycle.txt"`, but that's kind of lame, so you could also type `notes "motorcycle"`, or even `notes "moto*"`. If you're feeling extra crazy, you could get away with `m*` here. Basically if you pass a glob in, `peter-notes` will just take the first match from `--find` (see OPTIONS above) and open that. If you wanted to open all notes under `projects/` you could also use this same idea and run `notes "projects"`.
|
54
61
|
|
55
|
-
|
62
|
+
The close observer will have noticed that I'm leaving out `.txt` in most of my commands. That's not because `peter-notes` requires `.txt` files. In fact, you can use markdown or whatever kind of files you want, but `peter-notes` will totally ignore file extensions unless you provide one. If you plan on keeping most of your notes in some file-extension other than `.txt`, just add a line to your preferences file (below), but it really only effects `--new`.
|
56
63
|
|
57
64
|
Thats like what 90% of what youll ever need and no crazy macros or flags to memorize. Not bad right? Well not all flags are bad, in fact, you also get some super-helpful optional ones for the other 10%, just look above at the OPTIONS section.
|
58
65
|
|
@@ -66,24 +73,33 @@ options that you can set:
|
|
66
73
|
editor:
|
67
74
|
The editor of your choice. This value will get passed to bash so
|
68
75
|
make sure you use the exact name your terminal will understand.
|
69
|
-
Possible Values: [
|
70
|
-
(more?) I haven't tested others
|
71
|
-
|
72
|
-
|
73
|
-
Default Value: 'vim'
|
76
|
+
Possible Values: [vim, subl, atom, emacs, nano, ...]
|
77
|
+
(more?) I haven't tested others but I know
|
78
|
+
they're out there.
|
79
|
+
Default Value: vim
|
74
80
|
|
75
81
|
notes_dir:
|
76
82
|
The home of your notes. This is where `peter-notes` will look
|
77
83
|
for them.
|
78
84
|
Possible Values: any valid + existing dorectory path. I use
|
79
|
-
|
85
|
+
~/GoogleDrive/Notes because I track mine in
|
80
86
|
google drive (OverGrive for linux).
|
81
|
-
Default Value:
|
87
|
+
Default Value: ~/Notes
|
88
|
+
|
89
|
+
extension:
|
90
|
+
The default file-type extension for your notes.
|
91
|
+
Possible Values: [txt, md, yml, json, html, rb, ...]
|
92
|
+
anything your editor can understand that's a
|
93
|
+
valid file extension.
|
94
|
+
Default Value: txt
|
95
|
+
|
96
|
+
|
82
97
|
|
83
98
|
That's [yaml](http://www.yaml.org/start.html) so it should look like this:
|
84
99
|
|
85
100
|
editor: vim
|
86
|
-
notes_dir:
|
101
|
+
notes_dir: ~/Notes
|
102
|
+
extension: txt
|
87
103
|
|
88
104
|
## AUTHORS
|
89
105
|
|
data/peter-notes.gemspec
CHANGED
@@ -10,13 +10,13 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['peter.nfonseca@gmail.com']
|
11
11
|
|
12
12
|
spec.summary = %q{Lightweight notes manager}
|
13
|
-
spec.description = %q{Manage notes from the console
|
13
|
+
spec.description = %q{Manage your notes from the console.
|
14
14
|
|
15
|
-
If you're like me, you spend most of your computing time in a terminal
|
15
|
+
If you're like me, you spend most of your computing time in a terminal, you have a text-editor set up just to your liking, and you wish you could use it for everything. Naturally, when it comes time to ditch your paper note-pad, you refuse to to use the more popular gui-driven apps and want to find a way to use your editor instead.
|
16
16
|
|
17
|
-
But when you start looking for a
|
17
|
+
But when you start looking for a terminal-based notes framework (or plugin for your editor) you're blinded by crazy features and unwilling to learn a new tool. You've also already started keeping your notes in some text files and don't want to have to start over.
|
18
18
|
|
19
|
-
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them
|
19
|
+
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them and start using worlds simplest (and coolest) notes-manager.
|
20
20
|
|
21
21
|
This is a cli tool, don't try to import it into some ruby source code.}
|
22
22
|
spec.homepage = 'https://github.com/fonsecapeter/peter-notes'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peter-notes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Fonseca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: manpages
|
@@ -109,13 +109,13 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.4.2
|
111
111
|
description: |-
|
112
|
-
Manage notes from the console
|
112
|
+
Manage your notes from the console.
|
113
113
|
|
114
|
-
If you're like me, you spend most of your computing time in a terminal
|
114
|
+
If you're like me, you spend most of your computing time in a terminal, you have a text-editor set up just to your liking, and you wish you could use it for everything. Naturally, when it comes time to ditch your paper note-pad, you refuse to to use the more popular gui-driven apps and want to find a way to use your editor instead.
|
115
115
|
|
116
|
-
But when you start looking for a
|
116
|
+
But when you start looking for a terminal-based notes framework (or plugin for your editor) you're blinded by crazy features and unwilling to learn a new tool. You've also already started keeping your notes in some text files and don't want to have to start over.
|
117
117
|
|
118
|
-
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them
|
118
|
+
Anyway, I went through the same thing and made this this lightweight tool (originally from some aliases in my bashrc) to do what I wanted it to do, which isn't a lot. But, like ruby, it has a nice interface, and it'll stay out of the way. That means you can choose where you keep your notes, how you organize them, how you track them (if you do), and what editor you use to write them. So if you already have your own notes, you can just point `peter-notes` at them and start using worlds simplest (and coolest) notes-manager.
|
119
119
|
|
120
120
|
This is a cli tool, don't try to import it into some ruby source code.
|
121
121
|
email:
|
@@ -133,13 +133,18 @@ files:
|
|
133
133
|
- LICENSE.txt
|
134
134
|
- README.md
|
135
135
|
- Rakefile
|
136
|
+
- bin/build
|
136
137
|
- bin/console
|
137
138
|
- bin/notes
|
138
139
|
- bin/ronn
|
139
140
|
- bin/setup
|
141
|
+
- bin/tag
|
140
142
|
- bin/test
|
141
143
|
- lib/models/console_app.rb
|
142
|
-
- lib/models/
|
144
|
+
- lib/models/files/file_name.rb
|
145
|
+
- lib/models/files/glob.rb
|
146
|
+
- lib/models/files/note.rb
|
147
|
+
- lib/models/note_book.rb
|
143
148
|
- lib/models/preferences.rb
|
144
149
|
- lib/peter_notes/peter_notes.rb
|
145
150
|
- lib/peter_notes/version.rb
|
data/lib/models/notes.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'models/console_app'
|
2
|
-
require 'models/preferences'
|
3
|
-
require 'peter_notes/version'
|
4
|
-
|
5
|
-
class Notes < ConsoleApp
|
6
|
-
attr_reader :editor, :notes_dir
|
7
|
-
|
8
|
-
def initialize(prefs)
|
9
|
-
@editor = prefs.editor
|
10
|
-
@notes_dir = prefs.notes_dir
|
11
|
-
end
|
12
|
-
|
13
|
-
def search(regex)
|
14
|
-
system("grep --color=always -r #{@notes_dir} -e #{regex}")
|
15
|
-
end
|
16
|
-
|
17
|
-
def find(glob)
|
18
|
-
return [] if glob.nil? || glob.empty?
|
19
|
-
glob_path, glob_terminus = File.split(glob)
|
20
|
-
glob_path.gsub!(File::SEPARATOR, '.*')
|
21
|
-
cmd = "find \"#{@notes_dir}\" -name \"#{glob_terminus}\""
|
22
|
-
if glob_path != '.' # FILE::split breaks out . for bare file names
|
23
|
-
cmd += " | grep -e \"#{glob_path}\""
|
24
|
-
end
|
25
|
-
found = `#{cmd}`
|
26
|
-
return found.split
|
27
|
-
end
|
28
|
-
|
29
|
-
def open_notes(glob)
|
30
|
-
enter_dir
|
31
|
-
found = find(glob)[0]
|
32
|
-
if found.nil?
|
33
|
-
found = './'
|
34
|
-
end
|
35
|
-
system("#{@editor} #{found}")
|
36
|
-
leave_dir
|
37
|
-
end
|
38
|
-
|
39
|
-
def list(path)
|
40
|
-
path = path || ''
|
41
|
-
notes_path = File.join(@notes_dir, path)
|
42
|
-
system("tree #{notes_path}")
|
43
|
-
end
|
44
|
-
|
45
|
-
def on_run(glob)
|
46
|
-
open_notes(glob)
|
47
|
-
end
|
48
|
-
|
49
|
-
def version
|
50
|
-
return PeterNotes::VERSION
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def enter_dir
|
56
|
-
@cur_dir = Dir.pwd
|
57
|
-
Dir.chdir(@notes_dir)
|
58
|
-
end
|
59
|
-
|
60
|
-
def leave_dir
|
61
|
-
Dir.chdir(@cur_dir)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|