lslinks 0.2.1 → 0.4.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: 4e24b5a988c1a3050c71584c26cd492aa301903d5c733145d198cd0eec38ef9b
4
+ data.tar.gz: bac193ff4401aba524f337c5d19a5e52be8cd67d6dd33a0e72c37dfeaec8566b
5
5
  SHA512:
6
- metadata.gz: cc1e7fac94e558879fd215334c0983e296b9ce7ba84b01bb4c8c68e61b254ac894392b847c5e8039b40b7df308d1bbbe157dc6858edc0883be9bd0cb16a6bc18
7
- data.tar.gz: db30b0d790b97398d220793246e187756d8bbb69cf26fe599230ec6563ae7249641956a385ca335d5a2a62530661dc84120d3bf24bc9fe03336dec6a76331923
6
+ metadata.gz: 0307c7a47f343b9384a582983caa67d9ea9ff7697610e4319874cc00c67590bb516c6dd3253eba068acaa143f68251eb1a967595a235a18aab020bce110b80ff
7
+ data.tar.gz: 224bda5e54b2e5b1ef8924d0272e63719cb243d754381f8bc5ea6052f5e5d22ca725a0191f84042e4d3140de652ec1e10bd682f0f18303fc914c81ab19884bfd
data/Dockerfile ADDED
@@ -0,0 +1,20 @@
1
+ FROM ruby:3.2-alpine AS build
2
+
3
+ WORKDIR /opt/app
4
+ COPY . .
5
+ RUN set -eux && \
6
+ apk add --no-cache build-base git libxml2-dev && \
7
+ bundle install && \
8
+ bundle exec rake build && \
9
+ git rev-parse HEAD > pkg/COMMIT-ID
10
+
11
+ FROM ruby:3.2-alpine
12
+ RUN set -eux && \
13
+ apk add --no-cache libxml2
14
+ COPY --from=build /opt/app/pkg/* /usr/src/
15
+ RUN set -eux && \
16
+ apk add --no-cache --virtual build-dependencies build-base libxml2-dev && \
17
+ gem install /usr/src/*.gem && \
18
+ apk del --no-cache build-dependencies
19
+
20
+ ENTRYPOINT ["lslinks"]
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,27 +2,25 @@ 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: {},
19
20
  }
20
21
  rest_args = parser.permute(argv, into: options)
21
22
  resource_name = rest_args.shift
22
- if !resource_name
23
- $stderr.puts(parser.help)
24
- exit(1)
25
- end
23
+ resource_name = "-" if !resource_name
26
24
  return options, resource_name
27
25
  end
28
26
  end
@@ -1,3 +1,3 @@
1
1
  module Lslinks
2
- VERSION = "0.2.1"
2
+ VERSION = "0.4.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.4.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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -45,6 +45,7 @@ executables:
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - Dockerfile
48
49
  - LICENSE.txt
49
50
  - README.md
50
51
  - Rakefile