lslinks 0.2.1 → 0.4.0
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 +4 -4
- data/Dockerfile +20 -0
- data/README.md +6 -0
- data/lib/lslinks/formatter.rb +1 -1
- data/lib/lslinks/option_parser.rb +10 -12
- data/lib/lslinks/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e24b5a988c1a3050c71584c26cd492aa301903d5c733145d198cd0eec38ef9b
|
4
|
+
data.tar.gz: bac193ff4401aba524f337c5d19a5e52be8cd67d6dd33a0e72c37dfeaec8566b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/lslinks/formatter.rb
CHANGED
@@ -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]
|
5
|
+
parser.banner = "Usage: #{File.basename(Process.argv0)} [OPTIONS] [--] RESOURCE-NAME"
|
6
6
|
parser.version = Lslinks::VERSION
|
7
7
|
parser.separator("")
|
8
|
-
parser.separator("
|
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("
|
13
|
-
parser.on("
|
14
|
-
parser.on("--
|
15
|
-
parser.on("-
|
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
|
data/lib/lslinks/version.rb
CHANGED
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.
|
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-
|
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
|