bkmrq 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8634093579553dbf24bccae5aea2028ad55ac67dd189a9c52d583069a4675748
4
- data.tar.gz: 023a1c37aa64a72dd7f754ccbe730f44c71ed355e03219515431ad91a11051fa
3
+ metadata.gz: b9ba71423dbc23a1e716ccf018f1702385feeec95fdde1c4be1dbee34b823ceb
4
+ data.tar.gz: 2f02147129dff0527f09e0ef1676b57b4ec9ddf6dcc7e19abacec357eb932244
5
5
  SHA512:
6
- metadata.gz: 6518627468fc14ee99c2f38f1f40e5b73d875cba7c29c3fe994ceedf026176ba30f8df4b85f657d20146a38df23b93b92052fa5dc6f426c6729f5bc94b2a0de8
7
- data.tar.gz: a929707641a9efb193c81f29dd3177b898dfc6e155c5376b0eb43a33a73a96d991a5b9769ec4511df77b9a1d854e727fe06697b65eae90ce4bd2de95537cbca4
6
+ metadata.gz: 8cb16e0d10aa46b6970b4d8e8f18fda14d7591ef514ba55b9a2622d19ec47cc93512936b32dffaebff0879df6c73263073a5b722d2ba7bdfb409ef76e1bc8628
7
+ data.tar.gz: 44f04e3533b66cbbdced84bc9c3b2bc2d1cfde5ee0ce2e90781ad844fea2a5451a0e710b588fb54619c7ee329ab2c8bd799a122f61008b47342097e1f450f3ed
data/bin/bkmrq CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bkmrq/cli'
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) # this line should be removed in prod
5
5
 
6
+ require 'bkmrq/cli'
6
7
  Bkmrq::Cli.new(ARGV)
data/lib/bkmrq/app.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require 'fileutils'
4
5
  require 'bkmrq/docs_template'
5
6
  require 'bkmrq/browser_config'
6
7
 
@@ -9,8 +10,9 @@ module Bkmrq
9
10
  class App
10
11
  BLOCKLIST = ENV.fetch('BKMRQ_BLOCKLIST', '(pdf|google|file:)').split(',').map(&:strip)
11
12
 
12
- def initialize(browser: :brave, bookmarks_input: nil)
13
- @bookmarks_input = bookmarks_input || Bkmrq::BROWSER_CONFIG.dig(browser, :bookmark_file_path)
13
+ def initialize(browser: :brave, input_file: nil, output_path: nil, edit: false)
14
+ @bookmarks_input = input_file || Bkmrq::BROWSER_CONFIG.dig(browser, :bookmark_file_path)
15
+ @output_path = output_path || FileUtils.pwd
14
16
  end
15
17
 
16
18
  def export!
@@ -25,7 +27,7 @@ module Bkmrq
25
27
 
26
28
  def output_file
27
29
  @output_file ||= ::File.open(
28
- "bkmrq_export_#{String(Integer(Time.now))[0..-2]}.md",
30
+ File.join(@output_path, "bkmrq_export_#{String(Integer(Time.now))[0..-2]}.md"),
29
31
  'w+'
30
32
  )
31
33
  end
data/lib/bkmrq/cli.rb CHANGED
@@ -12,6 +12,11 @@ module Bkmrq
12
12
  def initialize(args)
13
13
  @opts = {}
14
14
  option_parser.parse!(sanitize_args(args), into: @opts)
15
+ Bkmrq::App.new(
16
+ **@opts.slice(
17
+ Bkmrq::Manual.options_specs.map(&:last)
18
+ )
19
+ ).export!
15
20
  end
16
21
 
17
22
  private
@@ -21,7 +26,7 @@ module Bkmrq
21
26
  # Option Parsing
22
27
  Bkmrq::Manual.options_specs.map do |option_spec|
23
28
  option_key = option_spec.pop
24
- args.on(*option_spec) { |input| @opts.send(:[]=, option_key, input) }
29
+ args.on(*option_spec) { |input| @opts[option_key] = input }
25
30
  end
26
31
 
27
32
  # Manual Printing
data/lib/bkmrq/manual.rb CHANGED
@@ -36,7 +36,7 @@ module Bkmrq
36
36
  '--input-file FILE',
37
37
  String,
38
38
  'Bookmarks file generated by your browser. (JSON FORMAT ONLY)',
39
- :'input-file'
39
+ :input_file
40
40
  ]
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ module Bkmrq
46
46
  '--output-file FILE',
47
47
  String,
48
48
  'Filepath for markdown generated by Bkmrq',
49
- :'output-file'
49
+ :output_path
50
50
  ]
51
51
  end
52
52
 
data/lib/bkmrq.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bkmrq
4
+ require 'bkmrq/app'
5
+ require 'bkmrq/browser_config'
6
+ require 'bkmrq/cli'
7
+ require 'bkmrq/docs_template'
8
+ require 'bkmrq/manual'
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bkmrq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sreedev Kodichath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-04 00:00:00.000000000 Z
11
+ date: 2021-11-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Bkmrq Converts Bookmarks stored by your browser in JSON format to a readable
14
14
  markdown format
@@ -19,6 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - bin/bkmrq
22
+ - lib/bkmrq.rb
22
23
  - lib/bkmrq/app.rb
23
24
  - lib/bkmrq/browser_config.rb
24
25
  - lib/bkmrq/cli.rb