journal-cli 1.0.15 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9552de8da086f7b0f989037ed511bf3a3b8bfd1caa6a14fa30699fd0ee50023
4
- data.tar.gz: 6983e3f0822f29dc68963bc20708a437173fd35235334aeabe7473250d731979
3
+ metadata.gz: a4136001bd545e3de4b52f3419a3519be7d553aa01f7b68a646f968bee9c08c9
4
+ data.tar.gz: c87a3326570e1776685ef4d9ab383890e391d1cdf2dfb44c34890f2120d813aa
5
5
  SHA512:
6
- metadata.gz: fddcd96db70769cada2847010d847aea3373c813378e24d2013be39629735c45ad2935951183d21f56c5d1f7a0646d41c3b67b6596e5ad5ccdd81571c92331e5
7
- data.tar.gz: e7aead96f200fb34603acf24486b9c45f7a72f6922e56b13fee71b52ad18a0baa6436dcec9743ff353231769230ab9d6f19541ae04fc3d40cce1efbe97a10be4
6
+ metadata.gz: 9005246872181e4dd93006b2b3c65d10575b868d1448cb641ac6da486612a63ba73b33ee9f5853ca2cd34e40ae28022701232736160145f059e31c725b35ccaf
7
+ data.tar.gz: 295e23386630c3df7f7cc68ce4bfed45861255d7441ccb7b9daace7667ee85f65580ba4026797c4b5173bb6c0df9abcc1983703109dd26301bdd725b67577736
data/.gitignore CHANGED
@@ -65,3 +65,4 @@ build-iPhoneSimulator/
65
65
  # Used by RuboCop. Remote config files pulled in from inherit_from directive.
66
66
  # .rubocop-https?--*
67
67
  html
68
+ *.bak
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.0.17
2
+
3
+ 2023-09-08 07:21
4
+
5
+ #### IMPROVED
6
+
7
+ - More confirmation messages when saving
8
+
9
+ ### 1.0.16
10
+
11
+ 2023-09-07 11:12
12
+
13
+ #### IMPROVED
14
+
15
+ - Use optparse for command line options
16
+ - Completion-friendly list of journals with `journal -l`
17
+
1
18
  ### 1.0.15
2
19
 
3
20
  2023-09-07 07:57
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- journal-cli (1.0.15)
4
+ journal-cli (1.0.17)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
 
7
7
  GEM
data/bin/journal CHANGED
@@ -2,17 +2,20 @@
2
2
 
3
3
  $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
4
4
  require 'journal-cli'
5
+ require 'optparse'
5
6
 
6
7
  module Journal
7
8
  class << self
8
9
  def usage
9
- puts "journal v#{Journal::VERSION}"
10
- puts
11
10
  puts 'Usage: journal [type] [date]'
12
11
  puts
13
12
  puts 'Available journal types:'
13
+ list_journals
14
+ end
15
+
16
+ def list_journals
14
17
  config = Journal.config
15
- puts(config['journals'].keys.map { |k| "- #{k}" })
18
+ puts config['journals'].keys
16
19
  end
17
20
 
18
21
  def run(args)
@@ -22,15 +25,6 @@ module Journal
22
25
  Process.exit 1
23
26
  end
24
27
 
25
- case args[0]
26
- when /(-v|--version)/
27
- puts "journal v#{Journal::VERSION}"
28
- Process.exit 0
29
- when /(help|-h|--help)/
30
- usage
31
- Process.exit 0
32
- end
33
-
34
28
  journal = args.shift
35
29
 
36
30
  date = if args.length.positive?
@@ -51,4 +45,29 @@ module Journal
51
45
  end
52
46
  end
53
47
 
48
+ optparse = OptionParser.new do |opts|
49
+ opts.banner = 'Usage: journal JOURNAL_KEY [NATURAL LANGUAGE DATE]'
50
+
51
+ opts.on('-v', '--version', 'Display version') do
52
+ puts "journal v#{Journal::VERSION}"
53
+ Process.exit 0
54
+ end
55
+
56
+ opts.on('-l', '--list', 'List available journals') do
57
+ Journal.list_journals
58
+ Process.exit 0
59
+ end
60
+
61
+ opts.on('-h', '--help', 'Display help') do
62
+ puts opts
63
+ puts
64
+ puts 'Available journal types:'
65
+ config = Journal.config
66
+ puts(config['journals'].keys.map { |k| "- #{k}" })
67
+ Process.exit 0
68
+ end
69
+ end
70
+
71
+ optparse.parse!
72
+
54
73
  Journal.run(ARGV)
@@ -63,6 +63,7 @@ module Journal
63
63
  cmd << %(-t #{@journal['tags'].join(' ')}) if @journal.key?('tags')
64
64
  cmd << %(-date "#{@date.strftime('%Y-%m-%d %I:%M %p')}")
65
65
  `echo #{Shellwords.escape(to_markdown(yaml: false, title: true))} | #{cmd.join(' ')} -- new`
66
+ puts "Entered into Day One"
66
67
  end
67
68
 
68
69
  def save_single_markdown
@@ -245,6 +246,7 @@ module Journal
245
246
  data.sort_by! { |e| e['date'] }
246
247
 
247
248
  File.open(db, 'w') { |f| f.puts JSON.pretty_generate(data) }
249
+ puts "Saved #{db}"
248
250
  end
249
251
  end
250
252
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Journal
4
- VERSION = '1.0.15'
4
+ VERSION = '1.0.17'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journal-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-07 00:00:00.000000000 Z
11
+ date: 2023-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler