cnote 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9df0e76707bb7a63ff3b121e9e0b4fa6143b66c7
4
+ data.tar.gz: 9950e8a6fff2d2c7de76fc9883a211b65312696e
5
+ SHA512:
6
+ metadata.gz: ee7ab59688e6773eb02255983795aca1c3957f6bd49ffc8fada57862017121d833cff46d974eef1b937bb92c806878d1b755bef8e4a7365bb7ac876c813b1d84
7
+ data.tar.gz: 26d390e8ac70d6179dd256f6fa0e37a262fc1ff4dc26ee956c88c98b87a48b75066b04f37c37792d5edf3d13bb8e585a1f886410a4f1277c1902f8a6b691f877
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.15.4
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Added at 2017-09-09 01:27:23 -0700 by tony:
6
+ gem "awesome_print", "~> 1.8"
7
+
8
+ # Added at 2017-09-09 03:13:22 -0700 by tony:
9
+ gem "colorize", "~> 0.8.1"
10
+
11
+ # Specify your gem's dependencies in cnote.gemspec
12
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Tony McCoy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # CNote
2
+ > CLI notes app for Linux (and probably macOS) ((and maybe Windows Subsystem for Linux)) written in Ruby
3
+
4
+ CNote is my personal system for managing notes. I wanted something snappy and lightweight that would let me search, tag and edit a folder full of markdown files using just my keyboard and some `vim`mish single-letter commands.
5
+
6
+ ## Installation
7
+
8
+ First of all, make sure you have a recent version of Ruby installed (including RubyGems). I'm using 2.4.0. Then run:
9
+
10
+ $ gem install cnote
11
+
12
+ ## Usage
13
+
14
+ CNote will be installed as a command on your machine. To get started, run `cnote`. The first time you run `cnote`, you'll be walked through the basic setup process which will produce a `.cnote.yaml` file within your `$HOME` directory. To skip this, just create the file yourself. Valid options for this file are covered [here](#).
15
+
16
+ ```
17
+ $ cnote
18
+
19
+ Hello, new user!
20
+ Enter the path to the folder where you would like to store your notes: _
21
+ ```
22
+
23
+ Running `cnote` again will drop you into a REPL interface where you can type in commands to interact with your notes. `help` will show the complete list while the program is running.
24
+
25
+ ```
26
+ $ cnote
27
+
28
+ Welcome to CNote! Type 'help' or 'h' to see a list of available commands.
29
+ > _
30
+ ```
31
+
32
+ Here are the available commands:
33
+
34
+ ### Commands
35
+
36
+ Keywords surrounded by `<these>` are placeholders. You would enter the real value yourself.
37
+
38
+ #### `list`
39
+ > Aliases: `l`, `ls`
40
+
41
+ Lists *every single* note in your notes directory (recursively). This might be a lot of notes. To search for something specific, you would use the `find` command.
42
+
43
+ ```bash
44
+ > list
45
+
46
+ All Notes
47
+ ---------
48
+
49
+ 1. Note Title
50
+ /subfolder/some-note.md
51
+ tags: [pickle] [fish]
52
+
53
+ 2. Note Title
54
+ /whatever.md
55
+ <no tags>
56
+
57
+ 3. ...
58
+
59
+ Listed 27 Notes
60
+ ```
61
+
62
+ #### `new <file_name>`
63
+ > Aliases: `create`, `n`, `c`
64
+
65
+ Creates a new note with the given filename. If you pass in a nested directory, the directory will be created relative to your `note_path` value from the configuration file.
66
+
67
+ ```bash
68
+ > new general/whatever.md
69
+ #=> creates file at '$note_path/general/whatever.md'
70
+
71
+ > create note.jpg
72
+ #=> creates file at '$note_path/note.md'
73
+ #=> (File extension is ignored. All notes are markdown.)
74
+
75
+ > c note.md
76
+ > n note.md
77
+ #=> All aliases do the same thing.
78
+ ```
79
+
80
+ #### `edit <note_number>`
81
+ > Aliases: `open`, `o`, `e`
82
+
83
+ Opens the note file in your editor of choice, first looking for the `editor` property in your `.cnote.yaml` config file, and if that fails, uses the `EDITOR` environment variable.
84
+
85
+ #### `delete <note_number(s)>`
86
+ > Aliases: `d`, `rm`
87
+
88
+ Deletes the note(s) specified by their numbers. The numbers will be whatever number appeared next to that note the last time the notes were listed.
89
+
90
+ ```bash
91
+ > delete 12
92
+
93
+ Are you sure you want to delete note number 12 with title 'Some Title Here'? [y/n] y
94
+ Deleted!
95
+
96
+ > _
97
+ ```
98
+
99
+ #### `find <search_term>`
100
+ > Aliases: `search`, `s`, `f`
101
+
102
+ Searches and returns a list of all notes whose title or contents contain the search term.
103
+
104
+ ```bash
105
+ > find cnote
106
+ #=> Returns a list of notes whose titles or content match the given term.
107
+ #=> Sample output:
108
+
109
+ Found 2 Notes
110
+ -------------
111
+
112
+ 1. CNote Commands
113
+ /cnote/commands.md
114
+ tags: [cnote] [programming]
115
+
116
+ 2. CNote Sync Backends
117
+ /cnote/cnote-sync.md
118
+ <no tags>
119
+
120
+ Listed 2 Notes
121
+
122
+ > find +t cnote
123
+ #=> Returns a list of notes that include the tag 'cnote'
124
+ #=> Sample output:
125
+
126
+ Found 1 Note
127
+ ------------
128
+
129
+ 1. CNote Commands
130
+ /cnote/commands.md
131
+ tags: [cnote] [programming]
132
+
133
+ Listed 1 Note
134
+
135
+ > find -t cnote
136
+ #=> Returns a list of notes that DO NOT contain the tag 'cnote'
137
+
138
+ > f project +t cnote
139
+ #=> Returns a list of notes that both match the text 'project' AND contain the tag 'cnote'
140
+ ```
141
+
142
+ #### `peek <note_number`
143
+
144
+ Shows a short preview of the note, just to make sure it's the one you're looking for before you commit to editing, tagging, etc.
145
+
146
+ ```bash
147
+ > peek 10
148
+ > p 10
149
+ #=> Shows the first 15 lines of note number 10
150
+ ```
151
+
152
+ #### `tag <note_number(s)> <tag> <tag> <tag> ...`
153
+ > Aliases: `t`
154
+
155
+ Adds a space separated list of tags to the note specified by its list number.
156
+
157
+ ```bash
158
+ > tag 15 pizza charcoal fishness
159
+ #=> Adds ['pizza', 'charcoal', 'fishness'] to the tag list of note number 15
160
+
161
+ > tag 4,17 double_tag
162
+ #=> Adds 'double_tag' to the tag lists of BOTH notes 4 and 17.
163
+ ```
164
+
165
+ #### `untag <note_number(s)> <tag> <tag> ...`
166
+ > Aliases: `ut`
167
+
168
+ Removes the space separated list of tags from the note specified by its list number. Works exactly the same as `tag`, but in reverse.
169
+
170
+ ## Configuration
171
+
172
+ CNote uses a YAML file called `.cnote.yaml` to store your preferences. The file is stored in your home directory and is editable in any text editor. Here are the options:
173
+
174
+ ```yaml
175
+ # note_path is the only required property.
176
+ # This is the root directory for your notes folder.
177
+ note_path: ~/Documents/Notes
178
+
179
+ # Optionally, you can provide an editor that CNote will
180
+ # open your notes in. This can be any editor that handles
181
+ # markdown files: vscode, gedit, emacs, etc...
182
+ editor: vim
183
+
184
+ # prompt can be any string. This will show up just
185
+ # before your cursor whenever CNote is waiting for you to
186
+ # type something.
187
+ prompt: "=> uLtR4Hax <=(🌭)>>"
188
+ ```
189
+
190
+ ## License
191
+
192
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cnote"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/cnote.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "cnote/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cnote"
8
+ spec.version = Cnote::VERSION
9
+ spec.authors = ["Tony McCoy"]
10
+ spec.email = ["tony@ratwizard.io"]
11
+
12
+ spec.summary = %q{Console notes!}
13
+ spec.description = %q{Take notes with a fast and efficient CLI}
14
+ spec.homepage = "https://www.tonymccoy.me/cnote"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.15"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+
28
+ spec.add_runtime_dependency "awesome_print", "~> 1.8"
29
+ spec.add_runtime_dependency "colorize", "~> 0.8.1"
30
+ end
data/exe/cnote ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "cnote"
data/lib/cnote.rb ADDED
@@ -0,0 +1,14 @@
1
+ require "colorize"
2
+ require_relative "cnote/config"
3
+ require_relative "cnote/notes"
4
+ require_relative "cnote/version"
5
+
6
+ # module Cnote
7
+ # Your code goes here...
8
+ # end
9
+
10
+ config = Config.new("~/.cnote.yaml")
11
+
12
+ # Start REPL
13
+ notes = Notes.new(config)
14
+ notes.await_command("\nWelcome to CNote! Type #{'help'.white} or #{'h'.white} to see a list of available commands.")
@@ -0,0 +1,3 @@
1
+ module Cnote
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cnote
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tony McCoy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: awesome_print
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.8'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.8.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.8.1
83
+ description: Take notes with a fast and efficient CLI
84
+ email:
85
+ - tony@ratwizard.io
86
+ executables:
87
+ - cnote
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - cnote.gemspec
101
+ - exe/cnote
102
+ - lib/cnote.rb
103
+ - lib/cnote/version.rb
104
+ homepage: https://www.tonymccoy.me/cnote
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.6.12
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Console notes!
128
+ test_files: []