zvv-cli 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/Gemfile +1 -8
- data/exe/zvv +9 -15
- data/lib/zvv/cli/version.rb +1 -1
- data/lib/zvv/cli.rb +0 -6
- data/zvv-cli.gemspec +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8beaff8e2a23d5324dbbc699caecec6952d9add84a0fba9ad7f646d092f53f82
|
4
|
+
data.tar.gz: b904773ebd70ec0db4aea799b2faeab3f0fe4d726e9e8619bc51d13238e737ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40f2955c405bd8dcf0c392fd57768ac3dcdb9d48b7285dfad38a4818dd3b59d2efc9c2b311f00d6dedfcb62d32b8f47d5e75aa5308105fb7ad1056d01b732190
|
7
|
+
data.tar.gz: 75f2feb32a96f75d0f27bf7eda25c05fe38f29fa4f9603a294c16c900d226d7c3cfffcb2f14ea23d1c607c75a186b15288ebc6c7db863dca0e249814d8fd4a4f
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/exe/zvv
CHANGED
@@ -5,6 +5,7 @@ require 'rubygems'
|
|
5
5
|
require 'commander'
|
6
6
|
require 'transprt'
|
7
7
|
require 'colorize'
|
8
|
+
require 'debug'
|
8
9
|
|
9
10
|
require 'zvv/cli'
|
10
11
|
require 'ostruct'
|
@@ -15,16 +16,6 @@ module Patches
|
|
15
16
|
def strftime
|
16
17
|
DateTime.iso8601(self).strftime('%H:%M')
|
17
18
|
end
|
18
|
-
|
19
|
-
def subzh
|
20
|
-
gsub('Zürich', 'Zh').
|
21
|
-
gsub('Bahnhof', 'Bhf')
|
22
|
-
end
|
23
|
-
|
24
|
-
def subcon
|
25
|
-
tokens = split(' ')
|
26
|
-
tokens[0][-1] + ' ' + tokens[1]
|
27
|
-
end
|
28
19
|
end
|
29
20
|
|
30
21
|
refine Hash do
|
@@ -63,7 +54,7 @@ class App
|
|
63
54
|
c.action do |args, options|
|
64
55
|
time = args[2] || Time.now.to_s
|
65
56
|
|
66
|
-
isArrivalTime = time.start_with?('@') || time.end_with?('@') ? 1 : 0
|
57
|
+
isArrivalTime = time.start_with?('@') || time.end_with?('@') ? '1' : '0'
|
67
58
|
time = time.gsub('@', '')
|
68
59
|
|
69
60
|
time += ':00' unless time.include? ':'
|
@@ -71,7 +62,7 @@ class App
|
|
71
62
|
time += 24 * 60 ** 2 if time < Time.now # Look up tomorrow's connections
|
72
63
|
|
73
64
|
|
74
|
-
connections = Transprt.connections(
|
65
|
+
connections = Transprt::Client.new.connections(
|
75
66
|
from: args[0],
|
76
67
|
to: args[1],
|
77
68
|
date: time.strftime('%Y-%m-%d'),
|
@@ -79,13 +70,16 @@ class App
|
|
79
70
|
isArrivalTime: isArrivalTime
|
80
71
|
)
|
81
72
|
|
73
|
+
# pp connections[0]
|
74
|
+
|
82
75
|
connections.to_ostruct.each_with_index do |c, i|
|
83
|
-
|
76
|
+
duration_sec = (DateTime.iso8601(c.to.arrival).to_time - DateTime.iso8601(c.from.departure).to_time).to_int
|
77
|
+
puts ("%-20s %5s %2d:%02d %-20s %5s" % [c.from.station.name, c.from.departure.strftime, duration_sec / 60 ** 2, (duration_sec % 60 ** 2) / 60, c.to.station.name, c.to.arrival.strftime])
|
84
78
|
c.sections.each do |s|
|
85
79
|
if s.walk
|
86
|
-
puts ("Walk (%
|
80
|
+
puts ("Walk (%sm) to %s" % [s.walk.duration, s.departure.station.name]).light_black
|
87
81
|
else
|
88
|
-
puts ("
|
82
|
+
puts ("%-20s %5s %2s%-3s %-20s %5s" % [s.departure.station.name, s.departure.departure.strftime, s.journey.category, s.journey.number[0..2], s.arrival.station.name, s.arrival.arrival.strftime]).light_black
|
89
83
|
end
|
90
84
|
end
|
91
85
|
puts unless i == connections.length - 1
|
data/lib/zvv/cli/version.rb
CHANGED
data/lib/zvv/cli.rb
CHANGED
data/zvv-cli.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zvv-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PJK
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: transprt
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.2.2
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 0.2.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: colorize
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,7 +160,7 @@ homepage: https://github.com/PJK/zvv-cli
|
|
160
160
|
licenses:
|
161
161
|
- MIT
|
162
162
|
metadata: {}
|
163
|
-
post_install_message:
|
163
|
+
post_install_message:
|
164
164
|
rdoc_options: []
|
165
165
|
require_paths:
|
166
166
|
- lib
|
@@ -175,9 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
|
179
|
-
|
180
|
-
signing_key:
|
178
|
+
rubygems_version: 3.4.10
|
179
|
+
signing_key:
|
181
180
|
specification_version: 4
|
182
181
|
summary: CLI for Swiss public transport network
|
183
182
|
test_files: []
|