lslinks 0.2.0 → 0.3.0

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: aa7bd2c9cd6dcb396ebfcb7267b7a1d70118fe172da958b2df999ef50fcd1f34
4
- data.tar.gz: f1cc6815ed745e323fe1478bd89bce0b0eb51eb0c8d20c64e7e038b95b1dfe64
3
+ metadata.gz: 72b04371df2e152286b300ce8a1d4a0caae9e17366d6128e010f42609e309001
4
+ data.tar.gz: cd9c7ea7b87414f768065b67b19ec1f96bb1aa887b07fa9c6522fee1c1622fe0
5
5
  SHA512:
6
- metadata.gz: ed1234dc4c584b720419060f199947df3cf5f17ec94cf132069deb834b84def678c713c42d3f116c57cef066e0440bf3d8df12cdf9be1b406238ef9760b4bb72
7
- data.tar.gz: ab2bfbf88b4a19909cd114a01a086bf00e392abddac854a97c87832250a803a69e800fd3c61ad15b834b14bb483071ad8180b384cf37a9eba99d49d668361468
6
+ metadata.gz: f9acce0ebd0999cb187556c2787d13a2ecb45bf6b5056fe2197ad9cab9b06886b15f0993ac1538d1cd6071816b87033e12703039b029a5e93942bc69c733d543
7
+ data.tar.gz: 31b73cacd96f6498577ccaf2b98cd9d8b587c2d8f7c50cf6547676294ff84db2855c628a40214b78178e4b119eeef844221c371d7b38befab61856a92c175b42
data/README.md CHANGED
@@ -35,6 +35,12 @@ $ lslinks -k https://www.ruby-lang.org/
35
35
  https://www.ruby-lang.org/en/
36
36
  ```
37
37
 
38
+ ### more options
39
+
40
+ ```console
41
+ $ lslinks --help
42
+ ```
43
+
38
44
  ## Development
39
45
 
40
46
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -2,7 +2,7 @@ module Lslinks::Formatter
2
2
  class << self
3
3
  def output(resource_name, link, stdout: $stdout, **options)
4
4
  link_uri = if options[:convert_links]
5
- URI(resource_name) + link.url
5
+ URI(options[:base] || resource_name) + link.url
6
6
  else
7
7
  link.uri
8
8
  end
@@ -2,17 +2,18 @@ class Lslinks::OptionParser < OptionParser
2
2
  class << self
3
3
  def call(argv)
4
4
  parser = new
5
- parser.banner = "Usage: #{File.basename(Process.argv0)} [OPTIONS] URI_or_path"
5
+ parser.banner = "Usage: #{File.basename(Process.argv0)} [OPTIONS] [--] RESOURCE-NAME"
6
6
  parser.version = Lslinks::VERSION
7
7
  parser.separator("")
8
- parser.separator("Basic options:")
9
- parser.on("-l", "list links with text")
10
- parser.on("-k", "--convert-links", "convert links to full URL")
8
+ parser.separator("RESOURCE-NAME are URL, local file path or stdin(-).")
11
9
  parser.separator("")
12
- parser.separator("HTTP input options:")
13
- parser.on("--user-agent=USER_AGENT") # from curl wget
14
- parser.on("--referer=REFERER") # from curl wget
15
- parser.on("-H", "--header=HEADER") # from curl wget
10
+ parser.separator("OPTIONS:")
11
+ parser.on("-l", "list links with text.") # from ls
12
+ parser.on("-k", "--convert-links", "convert links to full URL.") # from wget
13
+ parser.on("--base=BASE-URL", "specify base URL for '--convert-links' option.") # from wget
14
+ parser.on("--user-agent=USER-AGENT", "specify User-Agent header. same as '--user-agent=USER-AGENT'.") # from curl wget
15
+ parser.on("--referer=REFERER", "specify Referer header. same as '--referer=REFERER'.") # from curl wget
16
+ parser.on("-H", "--header=HEADER-LINE", "specify various headers in HTTP request. e.g.: --header='Accept-Language: ja'") # from curl wget
16
17
  parser.on("--compressed", "ignore. no effect.") # from curl
17
18
  options = {
18
19
  http_headers: {},
@@ -1,3 +1,3 @@
1
1
  module Lslinks
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/lslinks.rb CHANGED
@@ -13,6 +13,7 @@ module Lslinks
13
13
  end
14
14
  end
15
15
 
16
+ require "lslinks/version"
16
17
  (Pathname(__dir__).glob("**/*.rb") - [Pathname(__FILE__)]).map { |path|
17
18
  path.sub_ext("")
18
19
  }.sort.each do |path|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lslinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuya.Nishida.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-22 00:00:00.000000000 Z
11
+ date: 2023-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri