go_time 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/exe/gotime +13 -3
- data/lib/go_time/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b80f6922da9c84cf643b10d7c417e0b853506a7736e1817f56515a3199c259d5
|
4
|
+
data.tar.gz: 154a27679e95f6d1f9690bf31e43656f498e9fbc25629348abd46743093ac4e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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/
|
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
|
-
|
6
|
-
puts
|
5
|
+
unless ARGV.empty?
|
6
|
+
puts GoTime.convert(ARGV.join(" "), exception: true)
|
7
7
|
exit
|
8
8
|
end
|
9
|
-
|
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
|
data/lib/go_time/version.rb
CHANGED