lslinks 0.2.1 → 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: a994dcf8e74b0ea0ce83267b08498d3aebfeefd42a9981256337dce30e8903f2
4
- data.tar.gz: 60f91e8aa73a60f48344b8530ecd41ddaeed17b72640ccfc3632dea4c8c34c24
3
+ metadata.gz: 72b04371df2e152286b300ce8a1d4a0caae9e17366d6128e010f42609e309001
4
+ data.tar.gz: cd9c7ea7b87414f768065b67b19ec1f96bb1aa887b07fa9c6522fee1c1622fe0
5
5
  SHA512:
6
- metadata.gz: cc1e7fac94e558879fd215334c0983e296b9ce7ba84b01bb4c8c68e61b254ac894392b847c5e8039b40b7df308d1bbbe157dc6858edc0883be9bd0cb16a6bc18
7
- data.tar.gz: db30b0d790b97398d220793246e187756d8bbb69cf26fe599230ec6563ae7249641956a385ca335d5a2a62530661dc84120d3bf24bc9fe03336dec6a76331923
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.1"
2
+ VERSION = "0.3.0"
3
3
  end
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.1
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