kubetailrb 0.3.2 → 0.3.4

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: 5d65ae35af371643129787b391585cf8dfe636fdcee05bce4c6e4e5a7d8cb4a0
4
- data.tar.gz: 43905900ca1be1ded3263ae2a43605283cbffaa6879016f255b54cbc55858232
3
+ metadata.gz: 450f0eeb9fe08ebbd667673f0f17f0a230778fa372cf5f026764828fdd83827f
4
+ data.tar.gz: 0aa99a80f87e37f621feddf7b438b21fc81c1ce2668e241bc9251be49e8ab7b6
5
5
  SHA512:
6
- metadata.gz: 62b9f8373d2084749148179444317fc80bdc3dfd78e5c83cb437a42874dea9b6f4ce6ab984a9a726938b5e1ebb9903d3cede6da74bc489f12bceeec8cccef99f
7
- data.tar.gz: be92b4539793d423e5fdfc59b8b37128c619465b1334a5f06c98dbaade4b33cb5c485865ff1cd8bf5272b2956c0daa29a0e55e19cc3159eb9123892c2fa749f9
6
+ metadata.gz: 8f5dad93e9a3f922dc1f6b9491454ef1d2f48788d2480ee974b645d9e365ef2872e5d82975529e255eed9847c6feb9c7641a8d0e81e3353d04e3256da940408f
7
+ data.tar.gz: 4d27521edc71bad91b86bb220b3de32780078cca9c62ba0f1640b61765d9840f1dd2f4e748a62df646d4af018e4927909858f0d7917ea2aafe9e565f2529ef7e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.6
1
+ 4.0.5
@@ -11,7 +11,7 @@ module Kubetailrb
11
11
  Tail your Kubernetes pod logs at the same time.
12
12
 
13
13
  Usage:
14
- kubetailrb pod-query [flags]
14
+ kubetailrb [flags] pod-query
15
15
 
16
16
  Flags:
17
17
  -v, --version Display version.
@@ -21,6 +21,14 @@ module Kubetailrb
21
21
 
22
22
  MDCS_FLAGS = %w[-m --mdcs].freeze
23
23
 
24
+ FLAGS_WITH_VALUES = (
25
+ NAMESPACE_FLAGS +
26
+ [TAIL_FLAG] +
27
+ CONTAINER_FLAGS +
28
+ EXCLUDES_FLAGS +
29
+ MDCS_FLAGS
30
+ ).freeze
31
+
24
32
  attr_reader :reader
25
33
 
26
34
  def initialize(pod_query:, container_query:, opts:)
@@ -38,7 +46,7 @@ module Kubetailrb
38
46
  class << self
39
47
  def create(*args)
40
48
  new(
41
- pod_query: parse_pod_query(*args),
49
+ pod_query: parse_pod_query(args),
42
50
  container_query: parse_container_query(*args),
43
51
  opts: K8sOpts.new(
44
52
  namespace: parse_namespace(*args),
@@ -52,15 +60,21 @@ module Kubetailrb
52
60
  )
53
61
  end
54
62
 
55
- def parse_pod_query(*args)
56
- # TODO: We could be smarter here? For example, if the pod names are
57
- # provided at the end of the command, like this:
58
- # kubetailrb --tail 3 some-pod
59
- # The above command will not work because this method will return 3
60
- # instead of 'some-pod'...
61
- args.find { |arg| !arg.start_with? '-' }
63
+ def parse_pod_query(args)
64
+ args.each_with_index.find do |arg, idx|
65
+ !arg.start_with?('-') && !consumed_by_flag?(args, idx)
66
+ end&.first
62
67
  end
63
68
 
69
+ private
70
+
71
+ def consumed_by_flag?(args, idx)
72
+ prev = args[idx - 1]
73
+ FLAGS_WITH_VALUES.include?(prev)
74
+ end
75
+
76
+ public
77
+
64
78
  #
65
79
  # Parse k8s namespace from arguments provided in the CLI, e.g.
66
80
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kubetailrb
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubetailrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Lin
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: kubeclient
@@ -224,7 +223,6 @@ description: |
224
223
  Tail Kubernetes pod logs at the same time.
225
224
 
226
225
  Project used for learning Ruby and Rails.
227
- email:
228
226
  executables:
229
227
  - kubetailrb
230
228
  extensions: []
@@ -275,7 +273,6 @@ metadata:
275
273
  bug_tracker_uri: https://github.com/l-lin/kubetailrb/issues
276
274
  changelog_uri: https://github.com/l-lin/kubetailrb/blob/main/CHANGELOG.md
277
275
  source_code_uri: https://github.com/l-lin/kubetailrb
278
- post_install_message:
279
276
  rdoc_options: []
280
277
  require_paths:
281
278
  - lib
@@ -290,8 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
287
  - !ruby/object:Gem::Version
291
288
  version: '0'
292
289
  requirements: []
293
- rubygems_version: 3.5.22
294
- signing_key:
290
+ rubygems_version: 4.0.10
295
291
  specification_version: 4
296
292
  summary: Tail k8s pod logs at the same time.
297
293
  test_files: []