til-rb 0.0.4 → 0.0.5
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/til +16 -1
- data/lib/til/core.rb +5 -4
- data/lib/til/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f0027d094b71d1fa0d6f5e44cba6156437c0f9dea43db6975e4dae481d71836
|
4
|
+
data.tar.gz: 60d850a49f82d03580d8bcba303ee7a7fdf9dd099037c17947bdc86f19163ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea9f23f36f457bdbb0c75dfb8bdb3040ea2b77e65d29c7bf046aa7b94b45ac525d64984c3c2f74a02f794a60161d56baeab2143913a4865b4b2cb112da10e163
|
7
|
+
data.tar.gz: 1a0dc250f4939160acf604d1869cef37325427c155510c44ace0c1a335a331c8945d0d9b8ebe34334d310a1e4bd147662fdb5ccbec65c741ec32fcabb903b6dc
|
data/bin/til
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'til-rb'
|
4
|
+
require 'optparse'
|
4
5
|
|
5
|
-
|
6
|
+
options = {}
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = 'Usage: til [options]'
|
9
|
+
|
10
|
+
opts.on('-tTITLE', '--titleTITLE', 'Set the title from the command line') do |title|
|
11
|
+
options[:title] = title
|
12
|
+
end
|
13
|
+
|
14
|
+
opts.on('-h', '--help', 'Prints this help') do
|
15
|
+
puts opts
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
end.parse!
|
19
|
+
|
20
|
+
Til::Core.run options: options
|
data/lib/til/core.rb
CHANGED
@@ -5,7 +5,7 @@ require 'readline'
|
|
5
5
|
module Til
|
6
6
|
class Core
|
7
7
|
|
8
|
-
def self.run
|
8
|
+
def self.run(options: {})
|
9
9
|
# Exit if `fzf` is not available
|
10
10
|
# Optionally print a spinner
|
11
11
|
# Grab the list of existing categories
|
@@ -18,11 +18,12 @@ module Til
|
|
18
18
|
# Create the new file
|
19
19
|
# Create a new commit
|
20
20
|
# Output a link to the file and the link to edit it
|
21
|
-
til = new
|
21
|
+
til = new(options: options)
|
22
22
|
til.run
|
23
23
|
end
|
24
24
|
|
25
|
-
def initialize(kernel: Kernel, process: Process, env: ENV, github_client: nil, stderr: $stderr)
|
25
|
+
def initialize(options: {}, kernel: Kernel, process: Process, env: ENV, github_client: nil, stderr: $stderr)
|
26
|
+
@options = options
|
26
27
|
@kernel = kernel
|
27
28
|
@process = process
|
28
29
|
@env = env
|
@@ -41,7 +42,7 @@ module Til
|
|
41
42
|
if @new_category
|
42
43
|
selected_category = prompt_for_new_category
|
43
44
|
end
|
44
|
-
prepopulate_tempfile(selected_category)
|
45
|
+
prepopulate_tempfile(selected_category, @options[:title])
|
45
46
|
open_editor
|
46
47
|
til_content = read_file
|
47
48
|
commit_new_til(selected_category, til_content)
|
data/lib/til/version.rb
CHANGED