youplot 0.4.1 → 0.4.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: 6db41d30d7f51a3209bd6c17e805c7dd6bcaf68db325ffb2d23b95850837d8d4
4
- data.tar.gz: 1580e5501a9b635cc871c9d572549e4d33cc46e265ffe7befcd0a9d51285673a
3
+ metadata.gz: a924bdaf315e9b7b8afa65d0f02cdbb22c213fbf80908e2ae30d12d1bc3d9338
4
+ data.tar.gz: ea42f957954e37d8d1f4eaf3c789e52188f96aff1afbf99dae6179be14ab06d5
5
5
  SHA512:
6
- metadata.gz: 4a60bbfd3edf64151c20a23bb3e13b7f528e7a313030d8e1134bb5cac7918aff2cc604fca301c2a86c3f8e8a8a6b411bb0e28fbb15b179ff4528559ded890cc7
7
- data.tar.gz: b76603426970dc8d7c019bb394374d9c1e851a216a0d6607f5adcd9532649a25a6fd56113bce037d92a3eb66fdcab533f58391d8db93aa5091020c15c0043b16
6
+ metadata.gz: 602975a225b979ad6ca2a43ef038f18a23b48f034ddb2a06ffa3f4ca0d61cb805e6ef314afd00a897f8bc869fcce8b27fee895ac6e0f3f82bc7cbe8531369632
7
+ data.tar.gz: 0d9f77815d3c2e7f338dfe42f0b501a51dd9dd3de06cc367a7ee3de52e049a6a7e55ee3afc4cc2a525a724b07412f5807feba3c9aea33966d407d38d96fb8601
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
- <p align="center">
2
- <img src="logo.svg" width="60%" height="60%" />
3
- </p>
4
-
5
- ![Build Status](https://github.com/kojix2/youplot/workflows/test/badge.svg)
6
- [![Gem Version](https://badge.fury.io/rb/youplot.svg)](https://badge.fury.io/rb/youplot)
7
- [![Docs Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://rubydoc.info/gems/youplot)
8
- [![The MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
9
- [![DOI](https://zenodo.org/badge/283230219.svg)](https://zenodo.org/badge/latestdoi/283230219)
10
-
11
- YouPlot is a command line tool for Unicode Plotting working with data from standard stream.
12
-
13
- :bar_chart: Powered by [UnicodePlot](https://github.com/red-data-tools/unicode_plot.rb)
1
+ <div align="center">
2
+ <img src="logo.svg">
3
+ <hr>
4
+ <img alt="Build Status" src="https://github.com/red-data-tools/YouPlot/workflows/test/badge.svg">
5
+ <a href="https://rubygems.org/gems/youplot/"><img alt="Gem Version" src="https://badge.fury.io/rb/youplot.svg"></a>
6
+ <a href="https://zenodo.org/badge/latestdoi/283230219"><img alt="DOI" src="https://zenodo.org/badge/283230219.svg"></a>
7
+ <a href="https://rubydoc.info/gems/youplot/"><img alt="Docs Stable" src="https://img.shields.io/badge/docs-stable-blue.svg"></a>
8
+ <a href="LICENSE.txt"><img alt="The MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
9
+
10
+ YouPlot is a command line tool that draws plots on the terminal.
11
+
12
+ :bar_chart: Powered by [UnicodePlot](https://github.com/red-data-tools/unicode_plot.rb)
13
+ </div>
14
14
 
15
15
  ## Installation
16
16
 
@@ -20,8 +20,9 @@ gem install youplot
20
20
 
21
21
  ## Quick Start
22
22
 
23
- * `cat data.tsv | uplot <command> [options]` or
24
- * `uplot <command> [options] <data.tsv>`
23
+ <img alt="barplot" src="https://user-images.githubusercontent.com/5798442/101999903-d36a2d00-3d24-11eb-9361-b89116f44122.png" width=160> <img alt="histogram" src="https://user-images.githubusercontent.com/5798442/101999820-21cafc00-3d24-11eb-86db-e410d19b07df.png" width=160> <img alt="scatter" src="https://user-images.githubusercontent.com/5798442/101999827-27284680-3d24-11eb-9903-551857eaa69c.png" width=160> <img alt="density" src="https://user-images.githubusercontent.com/5798442/101999828-2abbcd80-3d24-11eb-902c-2f44266fa6ae.png" width=160> <img alt="boxplot" src="https://user-images.githubusercontent.com/5798442/101999830-2e4f5480-3d24-11eb-8891-728c18bf5b35.png" width=160>
24
+
25
+ `uplot <command> [options] <data.tsv>`
25
26
 
26
27
  ### barplot
27
28
 
@@ -33,7 +34,7 @@ curl -sL https://git.io/ISLANDScsv \
33
34
  ```
34
35
 
35
36
  <p align="center">
36
- <img alt="barplot" src="https://user-images.githubusercontent.com/5798442/101999903-d36a2d00-3d24-11eb-9361-b89116f44122.png">
37
+ <img alt="barplot" src="https://user-images.githubusercontent.com/5798442/101999903-d36a2d00-3d24-11eb-9361-b89116f44122.png">
37
38
  </p>
38
39
 
39
40
  ### histogram
@@ -100,10 +101,6 @@ curl -sL https://git.io/IRIStsv \
100
101
 
101
102
  ### count
102
103
 
103
- In this example, YouPlot counts the number of chromosomes where the gene is located from the human gene annotation file and it creates a bar chart. The human gene annotation file can be downloaded from the following website.
104
-
105
- * https://www.gencodegenes.org/human/
106
-
107
104
  ```sh
108
105
  cat gencode.v35.annotation.gff3 \
109
106
  | grep -v '#' | grep 'gene' | cut -f1 \
@@ -114,23 +111,21 @@ cat gencode.v35.annotation.gff3 \
114
111
  <img alt="count" src="https://user-images.githubusercontent.com/5798442/101999832-30b1ae80-3d24-11eb-96fe-e5000bed1f5c.png">
115
112
  </p>
116
113
 
114
+ In this example, YouPlot counts the number of chromosomes where genes are located.
115
+ * [GENCODE - Human Release](https://www.gencodegenes.org/human/)
116
+
117
117
  Note: `count` is not very fast because it runs in a Ruby script.
118
118
  This is fine in most cases, as long as the data size is small. If you want to visualize huge data, it is faster to use a combination of common Unix commands as shown below.
119
119
 
120
120
  ```sh
121
121
  cat gencode.v35.annotation.gff3 | grep -v '#' | grep 'gene' | cut -f1 \
122
- | sort | uniq -c | sort -nrk2 | awk '{print $2,$1}' \
123
- | uplot bar -d ' ' -t "The number of human gene annotations per chromosome" -c blue
122
+ | sort | uniq -c | sort -nrk1 \
123
+ | uplot bar --fmt yx -d ' ' -t "The number of human gene annotations per chromosome" -c blue
124
124
  ```
125
125
 
126
126
  ## Usage
127
127
 
128
- ### Why YouPlot?
129
-
130
- Wouldn't it be a pain to have to run R, Python, Julia, gnuplot or whatever REPL just to check your data?
131
- YouPlot is a command line tool for this purpose. With YouPlot, you can continue working without leaving your terminal and shell.
132
-
133
- ### How to use YouPlot?
128
+ ### Commands
134
129
 
135
130
  `uplot` is the shortened form of `youplot`. You can use either.
136
131
 
@@ -140,18 +135,7 @@ YouPlot is a command line tool for this purpose. With YouPlot, you can continue
140
135
  | `uplot <command> [options] data.tsv ...` | Take input from files |
141
136
  | `pipeline1 \| uplot <command> -O \| pipeline2` | Outputs data from stdin to stdout |
142
137
 
143
- ### Where to output the plot?
144
-
145
- By default, the plot is output to *standard error output*.
146
- The output file or stream for the plot can be specified with the `-o` option.
147
-
148
- ### Where to output the input data?
149
-
150
- By default, the input data is not shown anywhere.
151
- The `-O` option, with no arguments, outputs the input data directly to the standard output.
152
- This is useful when passing data to a subsequent pipeline.
153
-
154
- ### What types of plots are available?
138
+ ### Subcommands
155
139
 
156
140
  The following sub-commands are available.
157
141
 
@@ -164,74 +148,83 @@ The following sub-commands are available.
164
148
  | scatter | s | draw a scatter plot |
165
149
  | density | d | draw a density plot |
166
150
  | boxplot | box | draw a horizontal boxplot |
151
+ | | | |
152
+ | count | c | draw a barplot based on the number of occurrences (slow) |
153
+ | | | |
154
+ | colors | color | show the list of available colors |
167
155
 
168
- See Quick Start for `count`.
156
+ ### Output the plot
169
157
 
170
- | command | short | how it works |
171
- |-----------|-------|----------------------------------------------------------|
172
- | count | c | draw a barplot based on the number of occurrences (slow) |
158
+ * `-o`
159
+ * By default, the plot is output to **standard error output**.
160
+ * If you want to output to standard input, Use hyphen ` -o -` or no argument `uplot s -o | `.
173
161
 
174
- ### What if the header line is included?
162
+ ### Output the input data
175
163
 
176
- If your input data contains a header line, you need to specify the `-H` option.
164
+ * `-O`
165
+ * By default, the input data is not shown anywhere.
166
+ * If you want to pass the input data directly to the standard output, Use hyphen `-O -` or no argument `uplot s -O |`.
167
+ * This is useful when passing data to a subsequent pipeline.
177
168
 
178
- ### How to specify the delimiter?
169
+ ### Header
179
170
 
180
- Use the `-d` option. To specify a blank space, you can use `uplot bar -d ' ' data.txt`.
181
- You do not need to use `-d` option for tab-delimited text since the default value is tab.
171
+ * `-H`
172
+ * If input data contains a header line, you need to specify the `-H` option.
182
173
 
183
- ### Is there a way to specify a column as the x-axis or y-axis?
174
+ ### Delimiter
184
175
 
185
- Not yet.
186
- YouPlot treats the first column as the X axis and the second column as the Y axis.
187
- When working with multiple series, the first column is the X axis, the second column is series Y1, the third column is series Y2, and so on.
188
- If you pass only one column of data for `line` and `bar`, YouPlot will automatically use a sequential number starting from 1 as the X-axis.
176
+ * `-d`
177
+ * You do not need to use `-d` option for tab-delimited text since the default value is tab.
178
+ * To specify a blank space, you can use `uplot bar -d ' ' data.txt`.
189
179
 
190
- * `--fmt xyy` `--fmt xyxy` `--fmt yx` options give you a few more choices.
191
- See `youplot <command> --help` for more details.
180
+ ### Real-time data
192
181
 
193
- * Use `awk '{print $2, $1}'` to swap lines.
194
- * Use `paste` to concatenate series.
182
+ * `-p` `--progress`
183
+ * Experimental progressive mode is currently under development.
184
+ * `ruby -e 'loop{puts rand(100)}' | uplot line --progress`
195
185
 
196
- ### How to plot real-time data?
186
+ ### Show detailed options for subcommands
197
187
 
198
- Experimental progressive mode is currently under development.
188
+ * `--help`
189
+ * The `--help` option will show more detailed options for each subcommand.
190
+ * `uplot hist --help`
199
191
 
200
- ```sh
201
- ruby -e 'loop{puts rand(100)}' | uplot line --progress
202
- ```
192
+ ### Set columns as x-axis or y-axis
203
193
 
204
- ### How to view detailed command line options?
194
+ * YouPlot treats the first column as the X axis and the second column as the Y axis. When working with multiple series, the first column is the X axis, the second column is series Y1, the third column is series Y2, and so on.
195
+ * If you pass only one column of data for `line` and `bar`, YouPlot will automatically use a sequential number starting from 1 as the X-axis.
205
196
 
206
- Use `--help` to print command-specific options.
197
+ * `--fmt`
198
+ * `--fmt xyy` `--fmt xyxy` `--fmt yx` options give you a few more choices. See `youplot <command> --help` for more details.
199
+ * The fmt option may be renamed in the future.
200
+ * The `-x` and `-y` options might be used to specify columns in the future.
207
201
 
208
- `uplot hist --help`
202
+ * Use `awk '{print $2, $1}'` to swap columns. Use `paste` to concatenate series.
209
203
 
210
- ```
211
- Usage: uplot histogram [options] <in.tsv>
204
+ ### Categorical data
212
205
 
213
- Options for histogram:
214
- --symbol VAL character to be used to plot the bars
215
- --closed VAL side of the intervals to be closed [left]
216
- -n, --nbins VAL approximate number of bins
206
+ * With GNU datamash, you can manage to handle categorized data.
207
+ * `cat test/fixtures/iris.csv | sed '/^$/d' | datamash --header-in --output-delimiter=: -t, -g5 collapse 3,4 | cut -f2-3 -d: | sed 's/:/\n/g' | uplot s -d, -T --fmt xyxy`
208
+ * This is not so easy...
217
209
 
218
- Options:
219
- ...
220
- ```
210
+ ### Time series
221
211
 
222
- ### How to view the list of available colors?
212
+ * Not yet supported.
223
213
 
224
- ```sh
225
- uplot colors
226
- ```
214
+ ## Tools that are useful to use with YouPlot
215
+
216
+ * [csvtk](https://github.com/shenwei356/csvtk)
217
+ * [GNU datamash](https://www.gnu.org/software/datamash/)
218
+ * [awk](https://www.gnu.org/software/gawk/)
219
+ * [xsv](https://github.com/BurntSushi/xsv)
227
220
 
228
221
  ## Contributing
229
222
 
230
223
  YouPlot is a library under development, so even small improvements like typofix are welcome!
231
224
  Please feel free to send us your pull requests.
232
225
 
233
- * [Report bugs](https://github.com/kojix2/youplot/issues)
234
- * Fix bugs and [submit pull requests](https://github.com/kojix2/youplot/pulls)
226
+ * [Report bugs](https://github.com/red-data-tools/YouPlot/issues)
227
+ * Fix bugs and [submit pull requests](https://github.com/red-data-tools/YouPlot/pulls)
235
228
  * Write, clarify, or fix documentation
236
229
  * English corrections by native speakers are welcome.
237
230
  * Suggest or add new features
@@ -245,11 +238,15 @@ git clone https://github.com/your_name/YouPlot
245
238
  bundle install # Install the gem dependencies
246
239
  bundle exec rake test # Run the test
247
240
  bundle exec rake install # Installation from source code
241
+ bundle exec exe/uplot # Run youplot (Try out the edited code)
248
242
  ```
249
243
 
244
+ Do you need commit rights to my repository?
245
+ Do you want to get admin rights and take over the project?
246
+ If so, please feel free to contact us.
247
+
250
248
  ### Acknowledgements
251
249
 
252
- * [Red Data Tools](https://github.com/red-data-tools) - Technical support
253
250
  * [sampo grafiikka](https://jypg.net/sampo_grafiikka) - Project logo creation
254
251
  * [yutaas](https://github.com/yutaas) - English proofreading
255
252
 
@@ -6,6 +6,27 @@
6
6
  require_relative 'processing'
7
7
  require 'unicode_plot'
8
8
 
9
+ # If the line color is specified as a number, the program will display an error
10
+ # message to the user and exit. Remove this patch when UnicodePlot is improved.
11
+
12
+ module UnicodePlot
13
+ class << self
14
+ alias lineplot_original lineplot
15
+ def lineplot(*args, **kw)
16
+ if kw[:color].is_a? Numeric
17
+ warn <<~EOS
18
+ YouPlot: Line colors cannot be specified by numerical values.
19
+
20
+ For more information, please see the following issue.
21
+ https://github.com/red-data-tools/unicode_plot.rb/issues/34
22
+ EOS
23
+ YouPlot.run_as_executable ? exit(1) : raise(Error)
24
+ end
25
+ lineplot_original(*args, **kw)
26
+ end
27
+ end
28
+ end
29
+
9
30
  module YouPlot
10
31
  # plotting functions.
11
32
  module Backends
@@ -106,11 +127,10 @@ module YouPlot
106
127
 
107
128
  def plot_xyxy(data, method1, params)
108
129
  headers = data.headers
109
- series = data.series
130
+ series2 = data.series
131
+ .map { |s| s.map(&:to_f) }
132
+ .each_slice(2).to_a
110
133
  method2 = get_method2(method1)
111
- series.map! { |s| s.map(&:to_f) }
112
- series2 = series.each_slice(2).to_a
113
- series = nil
114
134
  params.name ||= headers[0] if headers
115
135
  params.xlim ||= series2.map(&:first).flatten.minmax # why need?
116
136
  params.ylim ||= series2.map(&:last).flatten.minmax # why need?
@@ -182,7 +202,7 @@ module YouPlot
182
202
  series = data.series
183
203
  if series.size == 1
184
204
  warn <<~EOS
185
- youplot: There is only one series of input data. Please check the delimiter.
205
+ YouPlot: There is only one series of input data. Please check the delimiter.
186
206
 
187
207
  Headers: \e[35m#{data.headers.inspect}\e[0m
188
208
  The first item is: \e[35m\"#{series[0][0]}\"\e[0m
@@ -40,6 +40,24 @@ module YouPlot
40
40
  return
41
41
  end
42
42
 
43
+ # config command
44
+ if @command == :config
45
+ if ENV['MYYOUPLOTRC']
46
+ puts "config file : #{ENV['MYYOUPLOTRC']}"
47
+ puts parser.config.inspect
48
+ else
49
+ puts <<~EOS
50
+ You don't have a config file. The default config file paths are:
51
+ ./.youplot.yml, ./.youplotrc, ~/.youplot.yml, ~/.youplotrc
52
+ You can specify a config file with the environment variable MYYOUPLOTRC.
53
+ File format is YAML. For example:
54
+ width : 40
55
+ height : 20
56
+ EOS
57
+ end
58
+ return
59
+ end
60
+
43
61
  # progressive mode
44
62
  if options[:progressive]
45
63
  stop = false
@@ -63,9 +81,15 @@ module YouPlot
63
81
  # normal mode
64
82
  else
65
83
  # Sometimes the input file does not end with a newline code.
66
- while (input = Kernel.gets(nil))
84
+ begin
85
+ begin
86
+ input = Kernel.gets(nil)
87
+ rescue Errno::ENOENT => e
88
+ warn e.message
89
+ next
90
+ end
67
91
  main(input)
68
- end
92
+ end until input
69
93
  end
70
94
  end
71
95
 
@@ -135,7 +159,12 @@ module YouPlot
135
159
  rescue CSV::MalformedCSVError => e
136
160
  warn 'Failed to parse the text. '
137
161
  warn 'Please try to set the correct character encoding with --encoding option.'
138
- raise e
162
+ warn e.backtrace.grep(/youplot/).first
163
+ exit 1
164
+ rescue ArgumentError => e
165
+ warn 'Failed to parse the text. '
166
+ warn e.backtrace.grep(/youplot/).first
167
+ exit 1
139
168
  end
140
169
 
141
170
  data
@@ -169,7 +198,7 @@ module YouPlot
169
198
  def output_data(input)
170
199
  # Pass the input to subsequent pipelines
171
200
  case options[:pass]
172
- when IO
201
+ when IO, StringIO
173
202
  options[:pass].print(input)
174
203
  else
175
204
  if options[:pass]
@@ -9,7 +9,8 @@ module YouPlot
9
9
  class Error < StandardError; end
10
10
 
11
11
  attr_reader :command, :options, :params,
12
- :main_parser, :sub_parser
12
+ :main_parser, :sub_parser,
13
+ :config_file, :config
13
14
 
14
15
  def initialize
15
16
  @command = nil
@@ -28,6 +29,55 @@ module YouPlot
28
29
  )
29
30
 
30
31
  @params = Parameters.new
32
+
33
+ if @config_file = find_config_file
34
+ ENV['MYYOUPLOTRC'] = @config_file
35
+ @config = read_config_file(config_file)
36
+ configure(config)
37
+ end
38
+ end
39
+
40
+ def candidate_paths
41
+ paths = []
42
+ paths << ENV['MYYOUPLOTRC'] if ENV['MYYOUPLOTRC']
43
+ paths << '.youplot.yml'
44
+ paths << '.youplotrc'
45
+ paths << File.join(ENV['HOME'], '.youplotrc') if ENV['HOME']
46
+ paths << File.join(ENV['HOME'], '.youplot.yml') if ENV['HOME']
47
+ paths
48
+ end
49
+
50
+ def find_config_file
51
+ config_file_path = nil
52
+ candidate_paths.each do |file|
53
+ path = File.expand_path(file)
54
+ if File.exist?(path)
55
+ config_file_path = path
56
+ break
57
+ end
58
+ end
59
+ config_file_path
60
+ end
61
+
62
+ def read_config_file(path)
63
+ require 'yaml'
64
+ YAML.load_file(path)
65
+ end
66
+
67
+ def configure(config)
68
+ option_members = @options.members
69
+ param_members = @params.members
70
+ # It would be more useful to be able to configure by plot type
71
+ config.each do |k, v|
72
+ k = k.to_sym
73
+ if option_members.include?(k)
74
+ @options[k] = v
75
+ elsif param_members.include?(k)
76
+ @params[k] = v
77
+ else
78
+ raise Error, "Unknown option/param: #{k}"
79
+ end
80
+ end
31
81
  end
32
82
 
33
83
  def create_base_parser
@@ -58,13 +108,13 @@ module YouPlot
58
108
  parser.on('-t', '--title STR', String, 'print string on the top of plot') do |v|
59
109
  params.title = v
60
110
  end
61
- parser.on('-x', '--xlabel STR', String, 'print string on the bottom of the plot') do |v|
111
+ parser.on('--xlabel STR', String, 'print string on the bottom of the plot') do |v|
62
112
  params.xlabel = v
63
113
  end
64
- parser.on('-y', '--ylabel STR', String, 'print string on the far left of the plot') do |v|
114
+ parser.on('--ylabel STR', String, 'print string on the far left of the plot') do |v|
65
115
  params.ylabel = v
66
116
  end
67
- parser.on('-w', '--width INT', Integer, 'number of characters per row') do |v|
117
+ parser.on('-w', '--width INT', Numeric, 'number of characters per row') do |v|
68
118
  params.width = v
69
119
  end
70
120
  parser.on('-h', '--height INT', Numeric, 'number of rows') do |v|
@@ -95,7 +145,7 @@ module YouPlot
95
145
  parser.on('-M', '--monochrome', TrueClass, 'no colouring even if writing to a tty') do |_v|
96
146
  UnicodePlot::IOContext.define_method(:color?) { false } # FIXME
97
147
  end
98
- parser.on('--encoding STR', String, 'Specify the input encoding') do |v|
148
+ parser.on('--encoding STR', String, 'specify the input encoding') do |v|
99
149
  options[:encoding] = v
100
150
  end
101
151
  # Optparse adds the help option, but it doesn't show up in usage.
@@ -118,7 +168,7 @@ module YouPlot
118
168
 
119
169
  Program: YouPlot (Tools for plotting on the terminal)
120
170
  Version: #{YouPlot::VERSION} (using UnicodePlot #{UnicodePlot::VERSION})
121
- Source: https://github.com/kojix2/youplot
171
+ Source: https://github.com/red-data-tools/YouPlot
122
172
 
123
173
  Usage: uplot <command> [options] <in.tsv>
124
174
 
@@ -130,10 +180,9 @@ module YouPlot
130
180
  scatter s draw a scatter plot
131
181
  density d draw a density plot
132
182
  boxplot box draw a horizontal boxplot
133
- colors color show the list of available colors
134
-
135
183
  count c draw a baplot based on the number of
136
184
  occurrences (slow)
185
+ colors color show the list of available colors
137
186
 
138
187
  General options:
139
188
  --help print command specific help menu
@@ -171,13 +220,13 @@ module YouPlot
171
220
 
172
221
  def sub_parser_add_xlim
173
222
  sub_parser.on_head('--xlim FLOAT,FLOAT', Array, 'plotting range for the x coordinate') do |v|
174
- params.xlim = v
223
+ params.xlim = v.map(&:to_f)
175
224
  end
176
225
  end
177
226
 
178
227
  def sub_parser_add_ylim
179
228
  sub_parser.on_head('--ylim FLOAT,FLOAT', Array, 'plotting range for the y coordinate') do |v|
180
- params.ylim = v
229
+ params.ylim = v.map(&:to_f)
181
230
  end
182
231
  end
183
232
 
@@ -278,6 +327,8 @@ module YouPlot
278
327
  options[:color_names] = v
279
328
  end
280
329
 
330
+ when :config
331
+
281
332
  else
282
333
  error_message = "uplot: unrecognized command '#{command}'"
283
334
  if YouPlot.run_as_executable?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YouPlot
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.4'
5
5
  end
data/lib/youplot.rb CHANGED
@@ -6,6 +6,12 @@ require_relative 'youplot/parameters'
6
6
  require_relative 'youplot/command'
7
7
 
8
8
  module YouPlot
9
+ # @run_as_executable = true / false
10
+ # YouPlot behaves slightly differently when run as a command line tool
11
+ # and when run as a script (e.g. for testing). In the event of an error,
12
+ # when run as a command line tool, YouPlot will display a short error message
13
+ # and exit abnormally. When run as a script, it will just raise an error.
14
+ @run_as_executable = false
9
15
  class << self
10
16
  attr_accessor :run_as_executable
11
17
 
@@ -13,5 +19,4 @@ module YouPlot
13
19
  @run_as_executable
14
20
  end
15
21
  end
16
- @run_as_executable = false
17
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youplot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-03 00:00:00.000000000 Z
11
+ date: 2022-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unicode_plot
@@ -16,84 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.0.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: simplecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: test-unit
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
26
+ version: 0.0.5
97
27
  description: A command line tool for Unicode Plotting
98
28
  email:
99
29
  - 2xijok@gmail.com
@@ -116,7 +46,7 @@ files:
116
46
  - lib/youplot/parameters.rb
117
47
  - lib/youplot/parser.rb
118
48
  - lib/youplot/version.rb
119
- homepage: https://github.com/kojix2/youplot
49
+ homepage: https://github.com/red-data-tools/YouPlot
120
50
  licenses:
121
51
  - MIT
122
52
  metadata: {}
@@ -135,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
65
  - !ruby/object:Gem::Version
136
66
  version: '0'
137
67
  requirements: []
138
- rubygems_version: 3.2.15
68
+ rubygems_version: 3.3.7
139
69
  signing_key:
140
70
  specification_version: 4
141
71
  summary: A command line tool for Unicode Plotting