go_time 0.2.0 → 0.2.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -2
  3. data/exe/gotime +13 -3
  4. data/lib/go_time/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c88d500abb89a086a286c4b5047e410698d50a1917584953be6f16b6e91d91d
4
- data.tar.gz: e1c296ab35fff78ac469519e71eab6f86c4911f2c30247ccf87e6082264d306e
3
+ metadata.gz: b80f6922da9c84cf643b10d7c417e0b853506a7736e1817f56515a3199c259d5
4
+ data.tar.gz: 154a27679e95f6d1f9690bf31e43656f498e9fbc25629348abd46743093ac4e8
5
5
  SHA512:
6
- metadata.gz: a708b3775da86dfa900a1fc114acf1cfe95de36ad3fed214c9279232fbf74c990a3a2e27458184803bc7366757ef28cd2c05051911081ca4b17f26cf5b50f535
7
- data.tar.gz: fbfc04046241439299223854ead51cf2c60ad4327576a3c66920078f8c3d7b9358fdbd85226aebcc530b25388a1d3e251bb400d1fcbc6072ec987574ee5efd22
6
+ metadata.gz: 83ed074e085cf895831a2f94bb9a9e2d407f02ba07af89ec5ad0bd9247207958aa8a578804e6a6a502b94de47a7a719fef1f36adfecca4cda6f91260aa64aba2
7
+ data.tar.gz: 2b4fef8475bfdb4be6db5521b77078a6726b7b917a9db7cb825c1431c904e237ed1044f9be94df227e3082b710028fbef6d7352bd1aba5eecada1ad2779a39dc
data/README.md CHANGED
@@ -48,6 +48,20 @@ time.strftime("Mon Jan _2 15:04:05 2006")
48
48
 
49
49
  For more information about format, please refer to the [Golang source code](https://golang.org/src/time/format.go).
50
50
 
51
+ ## gotime command
52
+
53
+ You can use `gotime` command to convert a golang format string to a strftime format string.
54
+
55
+ $ gotime 2006/01/02 15:04:05
56
+ %Y/%m/%d %H:%M:%S
57
+
58
+ $ gotime
59
+ > 2006/01/02
60
+ => %Y/%m/%d
61
+ > 2006/01/02 Z0700
62
+ unsupported syntax "Z0700"
63
+ > exit
64
+
51
65
  ## Extensions
52
66
 
53
67
  GoTime has extensions that support date and time representations in various languages.
@@ -67,7 +81,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
67
81
 
68
82
  ## Contributing
69
83
 
70
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/go_time. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/go_time/blob/main/CODE_OF_CONDUCT.md).
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nodai2hITC/go_time. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nodai2hITC/go_time/blob/main/CODE_OF_CONDUCT.md).
71
85
 
72
86
  ## License
73
87
 
@@ -75,4 +89,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
75
89
 
76
90
  ## Code of Conduct
77
91
 
78
- Everyone interacting in the GoTime project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/go_time/blob/main/CODE_OF_CONDUCT.md).
92
+ Everyone interacting in the GoTime project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nodai2hITC/go_time/blob/main/CODE_OF_CONDUCT.md).
data/exe/gotime CHANGED
@@ -2,8 +2,18 @@
2
2
 
3
3
  require "go_time"
4
4
 
5
- if ARGV.empty?
6
- puts 'usage example: gotime "Mon, 02 Jan 2006 15:04:05 -0700"'
5
+ unless ARGV.empty?
6
+ puts GoTime.convert(ARGV.join(" "), exception: true)
7
7
  exit
8
8
  end
9
- puts GoTime.convert(ARGV.join(" "), exception: true)
9
+
10
+ loop do
11
+ print "> "
12
+ str = gets.chomp
13
+ exit if str == "exit"
14
+ begin
15
+ puts "=> #{GoTime.convert(str, exception: true)}"
16
+ rescue ArgumentError => e
17
+ puts "\e[33m#{e}\e[0m"
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module GoTime
2
- VERSION = -"0.2.0"
2
+ VERSION = -"0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nodai2hITC