cureutils 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d85317471072f1a816290476f494c41c4882783e
4
- data.tar.gz: 85310285bf3aae7548b4332a61a325eb42fab8c4
3
+ metadata.gz: d5e393b752e1e939c5161fcbc1de1ce23c2efa21
4
+ data.tar.gz: c24bd33b230b22367c667c2766141eb884a508de
5
5
  SHA512:
6
- metadata.gz: 6885c95439a8bffca7bf7897affebbcdefdadff3e16b504683f79ce4509f287348c2910906ee57aa732b25b1979710a909244f3f21c95806544830b3d58b9046
7
- data.tar.gz: 0948107d8e0db92fe2ec312723f35714d2073e159fb3ec52906316b6eaf3ca4e143465b619bba475b946f615bfa5740def0ff27478d38433c2986f98d4ec1fd0
6
+ metadata.gz: b5bf7d46b18cd67ec3d91cb9d00c84859c90ca4493067d2f4311c7f6525befb30590800134ae983e990ecb439bd8e700bb15a4f44d9faa5deabd8ad0687b64a6
7
+ data.tar.gz: 606ad7edff5e687551f739f07a9fd9dcc7ef83dde6655435050fa1116a3b078744b711cc04f23d42775902a287a6d727ae13f227f536497aa2220af6758e6a12
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Yamada, Yasuhiro | Gre | GCSD
3
+ Copyright (c) 2016 Yamada, Yasuhiro
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,39 +1,197 @@
1
- # Cureutils
1
+ <p align="center">
2
+ <img src="./img/cureutils_logo.png" />
3
+ </p>
2
4
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cureutils`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ # Cureutils
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ Useful command line tool for Japanese battle heroine "Pretty Cure (Precure)".
6
8
 
7
9
  ## Installation
8
10
 
9
- Add this line to your application's Gemfile:
11
+ Install it yourself as:
12
+
13
+ $ gem install cureutils
14
+
15
+
16
+ After that, `cure` command is availabe.
17
+
18
+ $ cure
10
19
 
11
- ```ruby
12
- gem 'cureutils'
20
+ ## Usage
21
+
22
+ ### cure date
23
+ Display date, time and Precure related events.
24
+
25
+ ```sh
26
+ $ cure date
27
+ 2016-06-17 21:28:42 魔法つかいプリキュア!放映期間
13
28
  ```
14
29
 
15
- And then execute:
30
+ * %Y : Year
31
+ * %m : Month 01 - 12
32
+ * %d : Date 01 - 31
33
+ * @P : Precure related events.
34
+ * And other general date formats are usable.
16
35
 
17
- $ bundle
36
+ #### Options
18
37
 
19
- Or install it yourself as:
38
+ | Option | Description |
39
+ | ------ | --------- |
40
+ | -d | cure date -d STRING: display time described by STRING |
20
41
 
21
- $ gem install cureutils
22
42
 
23
- ## Usage
43
+ ```sh
44
+ $ cure date -d '3 years ago' '+%Y/%m @P'
45
+ 2013/06 ドキドキ!プリキュア放映期間
46
+ ```
24
47
 
25
- TODO: Write usage instructions here
26
48
 
27
- ## Development
49
+ ### cure echo
50
+ Print messages of Precure.
28
51
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+ ```sh
53
+ $ cure echo
54
+ みんなの思いを守るために
55
+ 心をひとつに!
56
+ 思いよ届け!キュアエコー!
57
+ ```
30
58
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
59
+ ### cure girls
60
+ Print girls' name
61
+
62
+ ```sh
63
+ $ cure girls
64
+ 美墨なぎさ
65
+ 雪城ほのか
66
+ 九条ひかり
67
+ 日向咲
68
+ 美翔舞
69
+ 夢原のぞみ
70
+ 夏木りん
71
+ 春日野うらら
72
+ 秋元こまち
73
+ 水無月かれん
74
+ ...
75
+ ```
32
76
 
33
- ## Contributing
77
+ ### cure grep
78
+ Print lines matching a pattern.
79
+
80
+ ```sh
81
+ $ echo キュア{レッド,ピンク,ブラック,ブルー,ホワイト}"\n" | cure grep
82
+ キュアブラック
83
+ キュアホワイト
84
+ ```
85
+
86
+ #### Options
87
+
88
+ | Option | Description |
89
+ | ------ | ----------- |
90
+ | -E | Interpret PATTERN as an extended regular expression. |
91
+ | -o | Print only the matched (non-empty) parts of a matching line, with each such part on a separate out. |
92
+
93
+
94
+ #### Folloing "Precure bracket expression" are available.
95
+
96
+ | Expression | Description |
97
+ | ---------- | -------------- |
98
+ | [:cast_name:] | Voice actor name. |
99
+ | [:color:] | Name of the color of the Precure. |
100
+ | [:girl_name:] | Girl name. |
101
+ | [:human_name:] | Real name before transforming. |
102
+ | [:precure_name:] | Precure name. |
103
+
104
+
105
+ ```sh
106
+ $ cat txt | cure grep '私は[:precure_name:]です。'
107
+ こんにちは、 私はキュアレモネードです。
108
+ ```
109
+
110
+ ### cure tr
111
+ Translate Precure related parameters.
34
112
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cureutils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
113
+ ```sh
114
+ $ echo 相田マナ | cure tr '[:human_name:]' '[:cast_name:]'
115
+ 生天目仁美
116
+ ```
117
+
118
+ #### Folloing "Precure bracket expression" are available.
119
+
120
+ | Expression | Description |
121
+ | ---------- | -------------- |
122
+ | [:cast_name:] | Voice actor name. |
123
+ | [:color:] | Name of the color of the Precure. |
124
+ | [:girl_name:] | Girl name. |
125
+ | [:human_name:] | Real name before transforming. |
126
+ | [:precure_name:] | Precure name. |
127
+
128
+
129
+ ### cure transform
130
+ Replace human_name to precure_name
131
+
132
+ ```sh
133
+ $ echo '私の名前は十六夜リコです。' | cure transform
134
+ 私の名前はキュアマジカルです。
135
+ ```
136
+
137
+ ### cure humanize
138
+ Change precure_name to human_name.
139
+
140
+ ```sh
141
+ $ echo キュア{ハート,エース} | cure humanize
142
+ 相田マナ 円亜久里
143
+ ```
144
+
145
+ ### cure janken
146
+ Let's play "Pikarin Janken" !
147
+
148
+ ```sh
149
+ $ cure janken
150
+ ピカピカピカリン
151
+ ジャンケンポン!
152
+ 1...グー, 2...チョキ, 3...パー : 1
153
+
154
+ あなた: グー
155
+ キュアピース: グー
156
+
157
+ [結果]
158
+ あいこ
159
+ ```
160
+
161
+ Exit status is changed depending on the result.
162
+
163
+ | Result | Exit status |
164
+ | ------ | ----------- |
165
+ | You win | 0 |
166
+ | You lose | 1 |
167
+ | Draw | 2 |
168
+
169
+ ### cure precures
170
+ Print Precure names
171
+
172
+ ```
173
+ $ cure precures
174
+ キュアブラック
175
+ キュアホワイト
176
+ シャイニールミナス
177
+ キュアブルーム
178
+ キュアイーグレット
179
+ キュアブライト
180
+ キュアウィンディ
181
+ キュアドリーム
182
+ キュアルージュ
183
+ キュアレモネード
184
+ ...
185
+ ```
186
+
187
+ ## Zsh completion
188
+
189
+ [etc/cure-completion.zsh](etc/cure-completion.zsh) is useful if you are using Zsh.
190
+
191
+
192
+ ## Contributing
36
193
 
194
+ Bug reports and pull requests are welcome on GitHub at https://github.com/greymd/cureutils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
37
195
 
38
196
  ## License
39
197
 
@@ -0,0 +1,124 @@
1
+ #compdef -U cure
2
+
3
+ # cureutils completion for zsh. Source from somewhere in your $fpath.
4
+
5
+ # cure CMD
6
+ subcommands=(
7
+ "help: Output the usage and exit."
8
+ "date: Display date, time and Precure related events."
9
+ "echo: Print messages of Precure."
10
+ "girls: Print girls' name"
11
+ "grep: Print lines matching a pattern."
12
+ "humanize: Change precure_name to human_name."
13
+ "janken: Let's play \"Pikarin Janken\" !"
14
+ "precures: Print Precure names"
15
+ "tr: Translate Precure related parameters."
16
+ "transform: Replace human_name to precure_name"
17
+ )
18
+
19
+ # cure precures | cure tr [:precure_name:] [:girl_name:] | grep '[[:alnum:]]' | sort | uniq | sed 's/^cure_//'
20
+ precure_girl_names=(
21
+ 'ace'
22
+ 'aqua'
23
+ 'beat'
24
+ 'beauty'
25
+ 'berry'
26
+ 'black'
27
+ 'bloom'
28
+ 'blossom'
29
+ 'diamond'
30
+ 'dream'
31
+ 'echo'
32
+ 'egret'
33
+ 'flora'
34
+ 'fortune'
35
+ 'happy'
36
+ 'heart'
37
+ 'honey'
38
+ 'lemonade'
39
+ 'lovely'
40
+ 'magical'
41
+ 'march'
42
+ 'marine'
43
+ 'melody'
44
+ 'mermaid'
45
+ 'mint'
46
+ 'miracle'
47
+ 'moonlight'
48
+ 'muse'
49
+ 'passion'
50
+ 'peace'
51
+ 'peach'
52
+ 'pine'
53
+ 'princess'
54
+ 'rhythm'
55
+ 'rosetta'
56
+ 'rouge'
57
+ 'scarlet'
58
+ 'sunny'
59
+ 'sunshine'
60
+ 'sword'
61
+ 'twinkle'
62
+ 'white'
63
+ 'milky_rose'
64
+ 'shiny_luminous'
65
+ )
66
+
67
+ function _cure-grep () {
68
+ local -a args
69
+ if (( CURRENT>=3 )) ;then
70
+ echo $words | grep -w -- '-o' 1> /dev/null || args=($args '-o:Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.')
71
+ echo $words | grep -w -- '-E' 1> /dev/null || args=($args '-E:Interpret PATTERN as an extended regular expression.')
72
+ _describe -t args 'args' args
73
+ fi
74
+ }
75
+
76
+ function _cure-tr () {
77
+ local -a args
78
+ if (( CURRENT>=3 )) ;then
79
+ echo $words | grep -w -- '\[\:girl_name\:\]' 1> /dev/null || args=($args '\[\:girl_name\:\]:Girl name.')
80
+ echo $words | grep -w -- '\[\:human_name\:\]' 1> /dev/null || args=($args '\[\:human_name\:\]:Real name before transforming.')
81
+ echo $words | grep -w -- '\[\:precure_name\:\]' 1> /dev/null || args=($args '\[\:precure_name\:\]:Precure name.')
82
+ echo $words | grep -w -- '\[\:cast_name\:\]' 1> /dev/null || args=($args '\[\:cast_name\:\]:Voice actor name.')
83
+ echo $words | grep -w -- '\[\:color\:\]' 1> /dev/null || args=($args '\[\:color\:\]:Name of the color of the Precure.')
84
+ _describe -t args 'args' args
85
+ fi
86
+ }
87
+
88
+ function _cure-echo () {
89
+ local -a args
90
+ if [[ ('--precure' == "${words[$CURRENT-1]}") || ('-p' == "${words[$CURRENT-1]}") ]] ; then
91
+ _describe -t precure_girl_names 'precure_girl_names' precure_girl_names
92
+ elif (( CURRENT>=3 )) ; then
93
+ echo $words | grep -w -- '-p' 1> /dev/null || args=($args '-p:Print messages of given Prequre.')
94
+ echo $words | grep -w -- '-q' 1> /dev/null || args=($args '-q:Print messages immediately.')
95
+ echo $words | grep -w -- '-a' 1> /dev/null || args=($args '-a:Print attack messages.')
96
+ echo $words | grep -w -- '-t' 1> /dev/null || args=($args '-t:Print transform message.')
97
+ _describe -t args 'args' args
98
+ fi
99
+ }
100
+
101
+ function _cure-date () {
102
+ local -a args
103
+ args=(
104
+ '-d: cure date -d STRING: display time described by STRING'
105
+ '+%Y/%m/%d_%H\:%M\:%S_@P: Example date string 1.'
106
+ '+%Y/%m/%d_@P: Example date string 2.'
107
+ )
108
+ if (( CURRENT==3 )) ; then
109
+ _describe -t args 'args' args
110
+ fi
111
+ if (( CURRENT==5 )) ; then
112
+ shift args
113
+ _describe -t args 'args' args
114
+ fi
115
+ }
116
+
117
+ function _cure()
118
+ {
119
+ if (( CURRENT==2 )) ; then
120
+ _describe -t subcommands 'subcommands' subcommands
121
+ elif (( CURRENT>2 )) ;then
122
+ _call_function ret _cure-"${words[2]}"
123
+ fi
124
+ }
Binary file
@@ -29,38 +29,26 @@ module Cureutils
29
29
  print_converted_text($stdin, :human_name, :precure_name)
30
30
  end
31
31
 
32
- desc 'humanize', 'Change precure_name to human_name'
32
+ desc 'humanize', 'Change precure_name to human_name.'
33
33
  def humanize
34
34
  print_converted_text($stdin, :precure_name, :human_name)
35
35
  end
36
36
 
37
- desc 'girls', 'Print girls\' name'
37
+ desc 'girls', "Print girls' name"
38
38
  def girls
39
39
  Rubicure::Girl.config.map { |_k, v| v[:human_name] }.uniq.each do |v|
40
40
  puts v
41
41
  end
42
42
  end
43
43
 
44
- desc 'precures', 'Print Precures\' name'
44
+ desc 'precures', 'Print Precure names'
45
45
  def precures
46
46
  Rubicure::Girl.config.map { |_k, v| v[:precure_name] }.uniq.each do |v|
47
47
  puts v
48
48
  end
49
49
  end
50
50
 
51
- desc 'mytest', 'print arguments.'
52
- option 'reduce', aliases: 'r'
53
- def mytest(arg1 = 'arg1', fname = nil)
54
- optstr = options[:reduce] ? options[:reduce] : 'empty'
55
- @io = $stdout
56
- @io.puts 'opt:' + optstr
57
- @io.puts 'arg1:' + arg1
58
- @io.puts 'fname:' + (fname ? fname : 'stdin')
59
- @input = input_from(fname)
60
- @input.each { |line| puts 'cap: ' + line }
61
- end
62
-
63
- desc 'grep [OPTIONS] PATTERN', 'print lines matching a pattern.'
51
+ desc 'grep [OPTIONS] PATTERN', 'Print lines matching a pattern.'
64
52
  option 'extended-regexp', aliases: 'E'
65
53
  option 'only-matching', aliases: 'o'
66
54
  def grep(pat = '[:precure_name:]', filename = nil)
@@ -103,14 +91,14 @@ module Cureutils
103
91
  end
104
92
  end
105
93
 
106
- desc 'tr PATTERN REPLACE', 'Extract precure name or other related params.'
94
+ desc 'tr PATTERN REPLACE', 'Translate Precure related parameters.'
107
95
  def tr(pat_from = '[:precure_name:]', pat_to = '[:human_name:]')
108
96
  pat_from = pregex2str(pat_from).to_sym
109
97
  pat_to = pregex2str(pat_to).to_sym
110
98
  print_converted_text($stdin, pat_from, pat_to)
111
99
  end
112
100
 
113
- desc 'echo PATTERN', 'Extract precure name or other related params.'
101
+ desc 'echo PATTERN', 'Print messages of Precure.'
114
102
  option 'quick', aliases: 'q',
115
103
  type: :boolean,
116
104
  desc: 'Print messages immediately.'
@@ -140,7 +128,7 @@ module Cureutils
140
128
  end
141
129
 
142
130
  desc 'date [OPTIONS] [+FORMAT]',
143
- 'Extract precure name or other related params.'
131
+ 'Display date, time and Precure related events.'
144
132
  option 'date', aliases: 'd'
145
133
  # Original date command's default is '+%a %b %e %H:%M:%S %Z %Y @P'
146
134
  # However, I would like to adopt this setting.
@@ -2,7 +2,7 @@ module Cureutils
2
2
  class Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  PRE = nil
7
7
 
8
8
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cureutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamada, Yasuhiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-13 00:00:00.000000000 Z
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,6 +132,8 @@ files:
132
132
  - Rakefile
133
133
  - bin/cure
134
134
  - cureutils.gemspec
135
+ - etc/cure-completion.zsh
136
+ - img/cureutils_logo.png
135
137
  - lib/cureutils.rb
136
138
  - lib/cureutils/cli.rb
137
139
  - lib/cureutils/cure_date_checker.rb