whale 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/whale +30 -5
- data/lib/whale.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9ceff0c76e62c60e4035b9a18c7dae65b245338
|
4
|
+
data.tar.gz: 8c3657ec1f8d2899c7cbe3ce116d1b52432f3d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7488100f9467c62001c95d777654e285516ca0a261553d923a9e9103315bf05a8749b66f126c4936cfb76111405d89a750e3d585cd06720db7920f08b1fef30
|
7
|
+
data.tar.gz: a77bd74957cebdabc74acab94767e16afb1a627dcfaf76db3770a6b3aae0bcf5b6f54318ad35c30e763eaf9fd326faca80dd95ec7a671edb98c72582df1c30bd
|
data/bin/whale
CHANGED
@@ -4,7 +4,7 @@ require 'logger'
|
|
4
4
|
|
5
5
|
USAGE = <<ENDUSAGE
|
6
6
|
Usage:
|
7
|
-
whale [filter] [-h] [-p paths] [-r] [-f file] [-e id] [-s tag]
|
7
|
+
whale [filter] [-h] [-p paths] [-r] [-f file] [-e id] [-s tag] [-c file]
|
8
8
|
[-w] [-n] [-t] [-v] [-d]
|
9
9
|
ENDUSAGE
|
10
10
|
|
@@ -16,6 +16,7 @@ HELP = <<ENDHELP
|
|
16
16
|
-f, --file The file to read
|
17
17
|
-e, --edit Open the editor at the given entry
|
18
18
|
-s, --sort Sort entries by tag value
|
19
|
+
-c, --create Create a new file
|
19
20
|
-w, --write Write the entries to stdout
|
20
21
|
-n, --name List the tag names
|
21
22
|
-t, --tags Show the tag values
|
@@ -64,6 +65,11 @@ filter
|
|
64
65
|
-s, --sort tag
|
65
66
|
Sort the entries by the given tag value.
|
66
67
|
|
68
|
+
-c, --create file
|
69
|
+
Create a new file with the given name. If the file exists, it is opened.
|
70
|
+
If no -p is given, the file is created at the WHALEPATH. If WHALEPATH is
|
71
|
+
not set, it is created at the current directory.
|
72
|
+
|
67
73
|
-w, --write
|
68
74
|
Write the entries, including title, body, and tags, to stdout.
|
69
75
|
|
@@ -98,6 +104,7 @@ ARGV.each do |arg|
|
|
98
104
|
when '-n','--name' then args[:name] = true
|
99
105
|
when '-t','--tags' then next_arg = :tags
|
100
106
|
when '-s','--sort' then next_arg = :sort
|
107
|
+
when '-c','--create' then next_arg = :create
|
101
108
|
when '-r','--recursive' then args[:recursive] = true
|
102
109
|
when '-w','--write' then args[:write] = true
|
103
110
|
when '-v','--version' then args[:version] = true
|
@@ -119,6 +126,17 @@ if args[:version]
|
|
119
126
|
exit
|
120
127
|
end
|
121
128
|
|
129
|
+
if args[:help]
|
130
|
+
puts USAGE
|
131
|
+
puts HELP
|
132
|
+
exit
|
133
|
+
end
|
134
|
+
|
135
|
+
if !next_arg.nil? and next_arg != :filter
|
136
|
+
puts USAGE
|
137
|
+
exit
|
138
|
+
end
|
139
|
+
|
122
140
|
files = []
|
123
141
|
files << args[:file] if args[:file]
|
124
142
|
paths = []
|
@@ -131,10 +149,16 @@ paths.each { |p| files += list_files_in_path(p, args[:recursive], logger) }
|
|
131
149
|
|
132
150
|
logger.debug(files)
|
133
151
|
|
134
|
-
if args[:
|
135
|
-
|
136
|
-
|
137
|
-
|
152
|
+
if args[:create]
|
153
|
+
if ENV['WHALEPATH']
|
154
|
+
filename = File.join(ENV['WHALEPATH'].split(':')[0], args[:create])
|
155
|
+
elsif args[:path]
|
156
|
+
filename = File.join(args[:path].split(':')[0], args[:create])
|
157
|
+
else
|
158
|
+
filename = args[:create]
|
159
|
+
end
|
160
|
+
open_editor(ENV['EDITOR'].to_sym, filename, 0, logger)
|
161
|
+
exit
|
138
162
|
end
|
139
163
|
|
140
164
|
entries = []
|
@@ -167,6 +191,7 @@ if args[:edit]
|
|
167
191
|
exit
|
168
192
|
end
|
169
193
|
open_editor(ENV['EDITOR'].to_sym, e.tags[:file], e.tags[:line], logger)
|
194
|
+
exit
|
170
195
|
end
|
171
196
|
|
172
197
|
if args[:name] and !args[:write]
|
data/lib/whale.rb
CHANGED
@@ -4,7 +4,7 @@ require 'set'
|
|
4
4
|
require 'logger'
|
5
5
|
|
6
6
|
MAJOR_VERSION = 0
|
7
|
-
MINOR_VERSION =
|
7
|
+
MINOR_VERSION = 4
|
8
8
|
REVISION = 0
|
9
9
|
|
10
10
|
$DEFAULT_TAGS = [:title, :body, :line, :file, :tags]
|
@@ -260,3 +260,4 @@ def parse_file(file, logger)
|
|
260
260
|
entries.each { |e| e.tags = file_entry.tags.merge(e.tags) }
|
261
261
|
return entries
|
262
262
|
end
|
263
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryutaro Ikeda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tag and filter your ideas
|
14
14
|
email: ryutaroikeda94@gmail.com
|