labrat 0.1.13 → 1.1.0
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 +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +2 -18
- data/.simplecov +18 -0
- data/Gemfile.lock +61 -46
- data/Notes.org +17 -0
- data/README.org +72 -53
- data/bin/labrat +2 -2
- data/labrat.gemspec +22 -4
- data/lib/config_files/config.yml +6 -1
- data/lib/config_files/labeldb.yml +7 -6
- data/lib/labrat/arg_parser.rb +18 -7
- data/lib/labrat/config.rb +9 -2
- data/lib/labrat/label.rb +7 -3
- data/lib/labrat/options.rb +7 -3
- data/lib/labrat/version.rb +1 -1
- data/lib/labrat.rb +1 -0
- data/lib/lisp/labrat.el +8 -8
- metadata +58 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cb6a8e4afc8a5d258a6e62936df099cfd3d14aa0cc538c3ea0e505640999c08
|
|
4
|
+
data.tar.gz: f99873b21e534ce721332491557be580d51c9b85431236fe3eac35e866e11e9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dad638049b53df861e9511308ebd27552681c1fd4fbb9e69ab5926db7a99f66e9c4248cc6d8fef3e9787c09c502f95ecd42dca54908f003a8d9eecf0bf0ee7d9
|
|
7
|
+
data.tar.gz: 2a903b57e3f2ba0ac02122b38c84e45de01b30d447617f8966f573c1ffe7dc2756f2bb5548f222341c575dffa78b8ca931ef435991bc0f2ae154f4c211e6a373
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# require:
|
|
5
|
-
# - rubocop-rspec
|
|
6
|
-
# - rubocop-performance
|
|
7
|
-
|
|
8
|
-
AllCops:
|
|
9
|
-
TargetRubyVersion: 2.7
|
|
10
|
-
|
|
11
|
-
Style/StringLiteralsInInterpolation:
|
|
12
|
-
Enabled: true
|
|
13
|
-
|
|
14
|
-
Layout/LineLength:
|
|
15
|
-
Max: 120
|
|
16
|
-
|
|
17
|
-
Style/MethodCallWithArgsParentheses:
|
|
18
|
-
Enabled: false
|
|
1
|
+
inherit_from:
|
|
2
|
+
- ~/.rubocop.yml
|
data/.simplecov
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- mode: ruby -*-
|
|
2
|
+
|
|
3
|
+
SimpleCov.start do
|
|
4
|
+
# any custom configs like groups and filters can be here at a central place
|
|
5
|
+
add_filter '/spec/'
|
|
6
|
+
add_filter '/tmp/'
|
|
7
|
+
add_group "Models", "lib/labrat"
|
|
8
|
+
# add_group "Core Extension", "lib/ext"
|
|
9
|
+
# After this many seconds between runs, old coverage stats are thrown out,
|
|
10
|
+
# so 3600 => 1 hour
|
|
11
|
+
merge_timeout 3600
|
|
12
|
+
# Make this true to merge rspec and cucumber coverage together
|
|
13
|
+
use_merging false
|
|
14
|
+
command_name 'Rspec'
|
|
15
|
+
nocov_token 'no_cover'
|
|
16
|
+
# Branch coverage
|
|
17
|
+
enable_coverage :branch
|
|
18
|
+
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,102 +1,117 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
labrat (0.
|
|
4
|
+
labrat (1.0.0)
|
|
5
5
|
activesupport
|
|
6
6
|
fat_core
|
|
7
|
+
matrix
|
|
7
8
|
prawn (~> 2.0)
|
|
8
9
|
|
|
9
10
|
GEM
|
|
10
11
|
remote: https://rubygems.org/
|
|
11
12
|
specs:
|
|
12
|
-
activesupport (6.1.
|
|
13
|
+
activesupport (6.1.7)
|
|
13
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
14
15
|
i18n (>= 1.6, < 2)
|
|
15
16
|
minitest (>= 5.1)
|
|
16
17
|
tzinfo (~> 2.0)
|
|
17
18
|
zeitwerk (~> 2.3)
|
|
18
19
|
ast (2.4.2)
|
|
19
|
-
byebug (11.1.3)
|
|
20
20
|
coderay (1.1.3)
|
|
21
|
-
concurrent-ruby (1.1.
|
|
21
|
+
concurrent-ruby (1.1.10)
|
|
22
22
|
damerau-levenshtein (1.3.3)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
debug (1.7.1)
|
|
24
|
+
irb (>= 1.5.0)
|
|
25
|
+
reline (>= 0.3.1)
|
|
26
|
+
diff-lcs (1.5.0)
|
|
27
|
+
docile (1.4.0)
|
|
28
|
+
fat_core (4.13.0)
|
|
29
|
+
activesupport (~> 6.0)
|
|
26
30
|
damerau-levenshtein
|
|
27
|
-
i18n (1.
|
|
31
|
+
i18n (1.12.0)
|
|
28
32
|
concurrent-ruby (~> 1.0)
|
|
33
|
+
io-console (0.6.0)
|
|
34
|
+
irb (1.6.2)
|
|
35
|
+
reline (>= 0.3.0)
|
|
36
|
+
json (2.6.3)
|
|
37
|
+
matrix (0.4.2)
|
|
29
38
|
method_source (1.0.0)
|
|
30
|
-
minitest (5.
|
|
31
|
-
parallel (1.
|
|
32
|
-
parser (3.
|
|
39
|
+
minitest (5.17.0)
|
|
40
|
+
parallel (1.22.1)
|
|
41
|
+
parser (3.2.0.0)
|
|
33
42
|
ast (~> 2.4.1)
|
|
34
43
|
pdf-core (0.9.0)
|
|
35
44
|
prawn (2.4.0)
|
|
36
45
|
pdf-core (~> 0.9.0)
|
|
37
46
|
ttfunk (~> 1.7)
|
|
38
|
-
pry (0.
|
|
47
|
+
pry (0.14.1)
|
|
39
48
|
coderay (~> 1.1)
|
|
40
49
|
method_source (~> 1.0)
|
|
41
|
-
|
|
42
|
-
byebug (~> 11.0)
|
|
43
|
-
pry (~> 0.13.0)
|
|
44
|
-
rainbow (3.0.0)
|
|
50
|
+
rainbow (3.1.1)
|
|
45
51
|
rake (13.0.6)
|
|
46
|
-
regexp_parser (2.
|
|
52
|
+
regexp_parser (2.6.1)
|
|
53
|
+
reline (0.3.2)
|
|
54
|
+
io-console (~> 0.5)
|
|
47
55
|
rexml (3.2.5)
|
|
48
|
-
rspec (3.
|
|
49
|
-
rspec-core (~> 3.
|
|
50
|
-
rspec-expectations (~> 3.
|
|
51
|
-
rspec-mocks (~> 3.
|
|
52
|
-
rspec-core (3.
|
|
53
|
-
rspec-support (~> 3.
|
|
54
|
-
rspec-expectations (3.
|
|
56
|
+
rspec (3.12.0)
|
|
57
|
+
rspec-core (~> 3.12.0)
|
|
58
|
+
rspec-expectations (~> 3.12.0)
|
|
59
|
+
rspec-mocks (~> 3.12.0)
|
|
60
|
+
rspec-core (3.12.0)
|
|
61
|
+
rspec-support (~> 3.12.0)
|
|
62
|
+
rspec-expectations (3.12.1)
|
|
55
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
56
|
-
rspec-support (~> 3.
|
|
57
|
-
rspec-mocks (3.
|
|
64
|
+
rspec-support (~> 3.12.0)
|
|
65
|
+
rspec-mocks (3.12.1)
|
|
58
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
59
|
-
rspec-support (~> 3.
|
|
60
|
-
rspec-support (3.
|
|
61
|
-
rubocop (1.
|
|
67
|
+
rspec-support (~> 3.12.0)
|
|
68
|
+
rspec-support (3.12.0)
|
|
69
|
+
rubocop (1.42.0)
|
|
70
|
+
json (~> 2.3)
|
|
62
71
|
parallel (~> 1.10)
|
|
63
|
-
parser (>= 3.
|
|
72
|
+
parser (>= 3.1.2.1)
|
|
64
73
|
rainbow (>= 2.2.2, < 4.0)
|
|
65
74
|
regexp_parser (>= 1.8, < 3.0)
|
|
66
|
-
rexml
|
|
67
|
-
rubocop-ast (>= 1.
|
|
75
|
+
rexml (>= 3.2.5, < 4.0)
|
|
76
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
|
68
77
|
ruby-progressbar (~> 1.7)
|
|
69
78
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
70
|
-
rubocop-ast (1.
|
|
71
|
-
parser (>= 3.
|
|
72
|
-
rubocop-performance (1.
|
|
79
|
+
rubocop-ast (1.24.1)
|
|
80
|
+
parser (>= 3.1.1.0)
|
|
81
|
+
rubocop-performance (1.15.2)
|
|
73
82
|
rubocop (>= 1.7.0, < 2.0)
|
|
74
83
|
rubocop-ast (>= 0.4.0)
|
|
75
|
-
rubocop-rspec (2.
|
|
76
|
-
rubocop (~> 1.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rubocop (~> 1.18)
|
|
84
|
+
rubocop-rspec (2.16.0)
|
|
85
|
+
rubocop (~> 1.33)
|
|
86
|
+
rubocop-shopify (2.11.1)
|
|
87
|
+
rubocop (~> 1.42)
|
|
80
88
|
ruby-progressbar (1.11.0)
|
|
89
|
+
simplecov (0.22.0)
|
|
90
|
+
docile (~> 1.1)
|
|
91
|
+
simplecov-html (~> 0.11)
|
|
92
|
+
simplecov_json_formatter (~> 0.1)
|
|
93
|
+
simplecov-html (0.12.3)
|
|
94
|
+
simplecov_json_formatter (0.1.4)
|
|
81
95
|
ttfunk (1.7.0)
|
|
82
|
-
tzinfo (2.0.
|
|
96
|
+
tzinfo (2.0.5)
|
|
83
97
|
concurrent-ruby (~> 1.0)
|
|
84
|
-
unicode-display_width (2.
|
|
85
|
-
zeitwerk (2.
|
|
98
|
+
unicode-display_width (2.4.2)
|
|
99
|
+
zeitwerk (2.6.6)
|
|
86
100
|
|
|
87
101
|
PLATFORMS
|
|
88
102
|
x86_64-linux
|
|
89
103
|
|
|
90
104
|
DEPENDENCIES
|
|
105
|
+
debug (>= 1.0.0)
|
|
91
106
|
labrat!
|
|
92
|
-
pry
|
|
93
|
-
pry-byebug (>= 3.9.0)
|
|
107
|
+
pry
|
|
94
108
|
rake (~> 13.0)
|
|
95
109
|
rspec (~> 3.0)
|
|
96
110
|
rubocop (~> 1.7)
|
|
97
111
|
rubocop-performance
|
|
98
112
|
rubocop-rspec
|
|
99
113
|
rubocop-shopify
|
|
114
|
+
simplecov
|
|
100
115
|
|
|
101
116
|
BUNDLED WITH
|
|
102
|
-
2.
|
|
117
|
+
2.3.4
|
data/Notes.org
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
* Lprint
|
|
2
|
+
|
|
3
|
+
See [[https://www.msweet.org/lprint/lprint.html][the documentation here]].
|
|
4
|
+
|
|
5
|
+
#+begin_src shell
|
|
6
|
+
sudo snap install lprint
|
|
7
|
+
sudo apt install gtk3-nocsd
|
|
8
|
+
set -gx LD_PRELOAD '/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0'
|
|
9
|
+
sudo lprint devices
|
|
10
|
+
snap list
|
|
11
|
+
snap get lprint
|
|
12
|
+
snap info --verbose lprint
|
|
13
|
+
lsusb
|
|
14
|
+
snap connections lprint
|
|
15
|
+
sudo snap connect lprint:raw-usb
|
|
16
|
+
lprint devices
|
|
17
|
+
#+end_src
|
data/README.org
CHANGED
|
@@ -10,7 +10,7 @@ The following is for org.
|
|
|
10
10
|
[[https://travis-ci.org/ddoherty03/labrat.svg?branch=master]]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
* Table of Contents :
|
|
13
|
+
* Table of Contents :toc_4:
|
|
14
14
|
- [[#labrat][Labrat]]
|
|
15
15
|
- [[#motivation][Motivation]]
|
|
16
16
|
- [[#a-tip-on-buying-file-folder-labels][A Tip on Buying File Folder Labels]]
|
|
@@ -32,9 +32,17 @@ The following is for org.
|
|
|
32
32
|
- [[#label-separator][Label separator]]
|
|
33
33
|
- [[#number-of-copies][Number of copies]]
|
|
34
34
|
- [[#input-and-output-files][Input and output files]]
|
|
35
|
+
- [[#output-file][Output file]]
|
|
36
|
+
- [[#command-line-arguments][Command-line arguments]]
|
|
37
|
+
- [[#specified-input-file][Specified input file]]
|
|
38
|
+
- [[#standard-input][Standard input]]
|
|
39
|
+
- [[#template-exception][Template exception]]
|
|
35
40
|
- [[#printing-or-viewing][Printing or viewing]]
|
|
36
41
|
- [[#shell-commands][Shell commands]]
|
|
37
42
|
- [[#aids-to-testing-label-layouts][Aids to testing label layouts]]
|
|
43
|
+
- [[#page-grid-1][Page Grid]]
|
|
44
|
+
- [[#page-template][Page Template]]
|
|
45
|
+
- [[#verbose-reporting][Verbose Reporting]]
|
|
38
46
|
- [[#the-label-database-and-the-label-option][The Label Database and the label option]]
|
|
39
47
|
- [[#listing-labels][Listing labels]]
|
|
40
48
|
- [[#system-label-database][System label database]]
|
|
@@ -51,7 +59,7 @@ wonderful [[https://github.com/prawnpdf/prawn][Prawn gem]] to generate PDF files
|
|
|
51
59
|
=labrat= properly configured, printing a label is as simple as:
|
|
52
60
|
|
|
53
61
|
#+begin_example
|
|
54
|
-
$ labrat 'Income Taxes 2021
|
|
62
|
+
$ labrat 'Income Taxes 2021-->Example Maker, Inc.'
|
|
55
63
|
#+end_example
|
|
56
64
|
|
|
57
65
|
And you will get a two-line file-folder label printed that looks like this:
|
|
@@ -77,14 +85,14 @@ without success, I decided to write my own. Hence labrat. With it---after
|
|
|
77
85
|
due configuration---printing a file folder label is as simple as:
|
|
78
86
|
|
|
79
87
|
#+begin_src sh
|
|
80
|
-
$ labrat 'First Line of Label
|
|
88
|
+
$ labrat 'First Line of Label-->And the Second Line'
|
|
81
89
|
#+end_src
|
|
82
90
|
|
|
83
91
|
Or, you can preview the label in your previewer of choice (mine is qpdfview)
|
|
84
92
|
by adding the -V flag:
|
|
85
93
|
|
|
86
94
|
#+begin_src sh
|
|
87
|
-
$ labrat -V 'First Line of Label
|
|
95
|
+
$ labrat -V 'First Line of Label-->And the Second Line'
|
|
88
96
|
#+end_src
|
|
89
97
|
|
|
90
98
|
Even better, I have included with =labrat= an elisp file (=labrat.el=) that
|
|
@@ -150,9 +158,9 @@ For the benefit of Emacs users, it also installs the =labrat.el= elisp library
|
|
|
150
158
|
in =~/.config/labrat= as well, though you may want to move it to a different
|
|
151
159
|
location.
|
|
152
160
|
|
|
153
|
-
If invoke =labrat-install= multiple times, it will refuse to overwrite any
|
|
154
|
-
existing config or database files that you may have
|
|
155
|
-
re-install them you have to move
|
|
161
|
+
If you invoke =labrat-install= multiple times, it will refuse to overwrite any
|
|
162
|
+
existing config or database files that you may have already installed. If you
|
|
163
|
+
want to re-install them you have to move the existing files out of the way.
|
|
156
164
|
|
|
157
165
|
** Setting options
|
|
158
166
|
You can control how =labrat= composes a label completely from the
|
|
@@ -166,11 +174,11 @@ Labrat reads options from the following locations, with the locations listed
|
|
|
166
174
|
from lowest to highest priority. In other words, options set in the
|
|
167
175
|
first-listed location can be overriden by settings in later-listed locations.
|
|
168
176
|
|
|
169
|
-
1.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
2.
|
|
173
|
-
|
|
177
|
+
1. From =/etc/xdg/labrat/config.yml=. This is a YAML formatted file in which
|
|
178
|
+
the long form of the option, without the leading '--', is used as a key
|
|
179
|
+
with the setting as the value.
|
|
180
|
+
2. From =~/.config/labrat/config.yml=. It also uses the YAML format based on
|
|
181
|
+
the long form of option names.
|
|
174
182
|
3. Finally, it reads options from the command-line, where, of course, the
|
|
175
183
|
leading hyphens are mandatory.
|
|
176
184
|
|
|
@@ -252,8 +260,8 @@ By default, =labrat= considers a page of labels to contain only one row and
|
|
|
252
260
|
one column, that is, a single label per page. To set up a multi-label page,
|
|
253
261
|
you have to describe the number of rows and columns and the amount of the gap
|
|
254
262
|
between them. The number of "rows" is counted as the number of "horizontal"
|
|
255
|
-
|
|
256
|
-
number of columns is counted as the number of "vertical"
|
|
263
|
+
sets of labels after taking the page orientation into account. Likewise, the
|
|
264
|
+
number of columns is counted as the number of "vertical" sets of labels after
|
|
257
265
|
taking the page orientation into account
|
|
258
266
|
|
|
259
267
|
- ~-R~, ~--rows=NUM~ :: The number of horizontal rows of labels on a page, taking
|
|
@@ -265,7 +273,7 @@ taking the page orientation into account
|
|
|
265
273
|
|
|
266
274
|
** Label Setup Options
|
|
267
275
|
These options determine the layout of individual labels within the page rather
|
|
268
|
-
than the page as a whole. Note that the dimensions of
|
|
276
|
+
than the page as a whole. Note that the dimensions of a single whole label is
|
|
269
277
|
not specified, but is implicitly determined by (1) the page width and height,
|
|
270
278
|
(2) the page margins, (3) the number of rows and columns per page, and (4) the
|
|
271
279
|
row and column gaps. The remaining space on the page is divided into a grid
|
|
@@ -279,10 +287,10 @@ side of the label:
|
|
|
279
287
|
- ~--bottom-pad=DIM~ :: Distance from bottom side of label to the printed text
|
|
280
288
|
- ~--left-pad=DIM~ :: Distance from left side of label to the printed text
|
|
281
289
|
- ~--right-pad=DIM~ :: Distance from right side of label to the printed text
|
|
282
|
-
- ~--v-pad=DIM~ :: Short for ~--top-pad=DIM~ and ~--bottom-pad~
|
|
283
|
-
- ~--h-pad=DIM~ :: Short for ~--left-pad=DIM~ and ~--right-pad~
|
|
284
|
-
- ~--pad=DIM~ :: Short for ~--top-pad=DIM~, ~--bottom-pad~, ~--left-pad=DIM~
|
|
285
|
-
and ~--right-pad~
|
|
290
|
+
- ~--v-pad=DIM~ :: Short for ~--top-pad=DIM~ and ~--bottom-pad=DIM~
|
|
291
|
+
- ~--h-pad=DIM~ :: Short for ~--left-pad=DIM~ and ~--right-pad=DIM~
|
|
292
|
+
- ~--pad=DIM~ :: Short for ~--top-pad=DIM~, ~--bottom-pad=DIM~, ~--left-pad=DIM~
|
|
293
|
+
and ~--right-pad=DIM~
|
|
286
294
|
|
|
287
295
|
*** Alignment
|
|
288
296
|
By default the label text is centered horizontally and vertically within the
|
|
@@ -298,8 +306,9 @@ label, but the following options allow you to alter that.
|
|
|
298
306
|
of these apply to the whole label text: there is no provision yet for doing
|
|
299
307
|
in-line changes of font styles.
|
|
300
308
|
|
|
301
|
-
- ~--font-name=
|
|
302
|
-
|
|
309
|
+
- ~--font-name=[Times|Courier|Helvetica]~ :: Name of font to use. Currently,
|
|
310
|
+
these are the only three fonts are available: Times, Courier, or Helvetica.
|
|
311
|
+
Without this option, Helvetica is used;
|
|
303
312
|
- ~--font-size=NUM~ :: Size of font to use in points (default 12)
|
|
304
313
|
- ~--font-style=[normal|bold|italic|bold-italic]~ :: Style of font to use for
|
|
305
314
|
text (default normal)
|
|
@@ -308,7 +317,7 @@ in-line changes of font styles.
|
|
|
308
317
|
Despite our best efforts, the vagaries of printer hardware, print drivers, and
|
|
309
318
|
cosmic rays, sometimes the text of the label is not positioned correctly
|
|
310
319
|
within the printable area of the label. These options allow you to nudge the
|
|
311
|
-
print area left or right, up or down
|
|
320
|
+
print area a bit, left or right, up or down, to compensate for any such
|
|
312
321
|
anomalies.
|
|
313
322
|
|
|
314
323
|
- ~-x, --delta-x=DIM~ :: Left-right adjustment (positive moves right, negative
|
|
@@ -322,10 +331,11 @@ The following options control the processing of labels by =labrat=.
|
|
|
322
331
|
*** Starting label
|
|
323
332
|
When printing onto a multi-label page, some of the labels may have already
|
|
324
333
|
been used. In that case, the ~--start-label~ option allows you to tell
|
|
325
|
-
=labrat= to start printing at some later label on the page.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
334
|
+
=labrat= to start printing at some later label on the first page. This option
|
|
335
|
+
has no impact on pages after the first. The label positions are numbered from
|
|
336
|
+
1 up to the number of labels per page (i.e., rows times columns) from left to
|
|
337
|
+
right and down the page. If you want to print a sheet that shows the label
|
|
338
|
+
numbers, see the ~-T~ template option below.
|
|
329
339
|
|
|
330
340
|
- ~-S NUM~, ~--start-label=NUM~ :: Start printing at label number NUM (starting
|
|
331
341
|
at 1, left-to-right, top-to-bottom) within first page only. Later pages
|
|
@@ -336,27 +346,27 @@ later pages always start on the first label position.
|
|
|
336
346
|
|
|
337
347
|
*** New line marker
|
|
338
348
|
You can embed a special text-sequence in the label text to indicate where a
|
|
339
|
-
line-break should occur. By default it is the sequence
|
|
340
|
-
=labrat= will translate all occurrences of
|
|
341
|
-
even consecutive occurrences. There is no way to escape this in
|
|
342
|
-
if you want labels for
|
|
343
|
-
|
|
349
|
+
line-break should occur. By default it is the sequence =-->=. This means
|
|
350
|
+
that =labrat= will translate all occurrences of =-->= in the text into a
|
|
351
|
+
line-break, even consecutive occurrences. There is no way to escape this in
|
|
352
|
+
the text, so if you want labels for that use '-->' as part of the text, you
|
|
353
|
+
are going to have difficulty printing a labels. But you can change the marker
|
|
344
354
|
to something else with ~--nlsep~. This is especially helpful when you are
|
|
345
355
|
using the command-line to supply the label text since specifying line-breaks
|
|
346
356
|
on a shell command can be difficult. However note that this substitution
|
|
347
357
|
takes place even when reading label texts from a file or standard input.
|
|
348
358
|
|
|
349
359
|
- ~-n~, ~--nlsep=SEPARATOR~ :: Specify text to be translated into a line-break
|
|
350
|
-
(default '
|
|
360
|
+
(default '-->')
|
|
351
361
|
|
|
352
362
|
*** Label separator
|
|
353
363
|
The only way to print more than one label from the command-line is to indicate
|
|
354
364
|
where one label ends and the next begins with a special marker in the
|
|
355
|
-
command-line arguments, by default the string '
|
|
365
|
+
command-line arguments, by default the string '==>'. The text used for this
|
|
356
366
|
can be customized with this option.
|
|
357
367
|
|
|
358
368
|
- ~--label-sep=SEPARATOR~ :: Specify text that indicates the start of a new
|
|
359
|
-
label (default '
|
|
369
|
+
label (default '==>')
|
|
360
370
|
|
|
361
371
|
*** Number of copies
|
|
362
372
|
This option causes =labrat= to generate multiple copies of each label with all
|
|
@@ -378,11 +388,11 @@ on the command-line. It combines all the non-option arguments and joins them
|
|
|
378
388
|
with a space between each argument. For example,
|
|
379
389
|
|
|
380
390
|
#+begin_example
|
|
381
|
-
$ labrat -c3 This is a 'single label' '
|
|
391
|
+
$ labrat -c3 This is a 'single label' '-->composed of all this' text --font-style=italic
|
|
382
392
|
#+end_example
|
|
383
393
|
|
|
384
394
|
prints three copies of a single label in italics with two lines, breaking at
|
|
385
|
-
the '
|
|
395
|
+
the '-->' marker, resulting in something like this:
|
|
386
396
|
|
|
387
397
|
#+begin_example
|
|
388
398
|
This is a single label
|
|
@@ -391,12 +401,12 @@ composed of all this text
|
|
|
391
401
|
|
|
392
402
|
Note that when the label text is specified on the command-line, ~labrat~ just
|
|
393
403
|
prints a single label. The only ways to get multiple labels is by (1) marking
|
|
394
|
-
a separation between labels with the ~--label-sep~ marker ('
|
|
404
|
+
a separation between labels with the ~--label-sep~ marker ('==>' by default)
|
|
395
405
|
or (2) using the ~-c~ (~--copies~) argument to get multiple copies of the
|
|
396
406
|
label text. These options can be combined as well. For example,
|
|
397
407
|
|
|
398
408
|
#+begin_example
|
|
399
|
-
$ labrat -c3 This is the 'first label'
|
|
409
|
+
$ labrat -c3 This is the 'first label' ==> 'And the rest --> is the second' text --font-style=italic
|
|
400
410
|
#+end_example
|
|
401
411
|
|
|
402
412
|
will produce three copies of two separate labels:
|
|
@@ -438,9 +448,10 @@ as for a specified ~in-file~, treating each paragraph as a label text and
|
|
|
438
448
|
disregarding comments.
|
|
439
449
|
|
|
440
450
|
**** Template exception
|
|
441
|
-
Notwithstanding all of the above, if the ~-T~ (~--template~) option is given
|
|
442
|
-
|
|
443
|
-
ignored and a template is
|
|
451
|
+
Notwithstanding all of the above, if the ~-T~ (~--template~) option is given
|
|
452
|
+
(see below at [[*Aids to testing label layouts][Aids to testing label layouts]]), all label texts from the
|
|
453
|
+
command-line, an ~in-file~, or standard input are ignored and a template is
|
|
454
|
+
generated.
|
|
444
455
|
|
|
445
456
|
*** Printing or viewing
|
|
446
457
|
By default, =labrat= prints the generated output file to the printer named
|
|
@@ -466,7 +477,8 @@ any event.
|
|
|
466
477
|
|
|
467
478
|
- ~-p~, ~--printer=NAME~ :: Name of the label printer to print on
|
|
468
479
|
- ~-%~, ~--print-command=PRINTCMD~ :: Command to use for printing with %p for
|
|
469
|
-
printer name; %o for label file name
|
|
480
|
+
printer name; %o for label file name (the `%` is meant to remind you of a
|
|
481
|
+
piece of a paper beingg fed between two rollers)
|
|
470
482
|
|
|
471
483
|
Likewise, =labrat= uses the shell command
|
|
472
484
|
#+begin_example
|
|
@@ -478,11 +490,16 @@ very likely that you will want to configure this with the ~--view-command~
|
|
|
478
490
|
option to your liking.
|
|
479
491
|
|
|
480
492
|
- ~-:~, ~--view-command=VIEWCMD~ :: Command to use for viewing with %o for
|
|
481
|
-
label file name
|
|
493
|
+
label file name (the `:` is meant to remind you of a pair of eyes looking at
|
|
494
|
+
the purdy label)
|
|
482
495
|
|
|
483
496
|
*** Aids to testing label layouts
|
|
497
|
+
|
|
498
|
+
**** Page Grid
|
|
484
499
|
The following options are very useful if your are trying to configure the set
|
|
485
|
-
up for a new label type or otherwise trying to figure out a problem
|
|
500
|
+
up for a new label type or otherwise trying to figure out a problem, such as
|
|
501
|
+
setting the ~--delta-x~ or ~--delta-y~ values for your setup.
|
|
502
|
+
|
|
486
503
|
Normally, =labrat= does not print an outline for the labels, but if you are
|
|
487
504
|
testing things out on plain paper, it helps to know where =labrat= thinks the
|
|
488
505
|
boundaries of the labels are. That is what the ~--grid~ or ~-g~ options
|
|
@@ -490,14 +507,16 @@ provide.
|
|
|
490
507
|
|
|
491
508
|
- ~-g~, ~--[no-]grid~ :: Add grid lines to output
|
|
492
509
|
|
|
510
|
+
**** Page Template
|
|
493
511
|
When trying to define a new label layout, it also helps to just see what a
|
|
494
|
-
single sheet of labels would look like. That is what the ~--template~ or
|
|
495
|
-
option
|
|
496
|
-
but ignores any label text.
|
|
512
|
+
single sheet of labels would look like. That is what the ~--template~ (or
|
|
513
|
+
~-T~) option gives you: it just prints an outline of where labels would be
|
|
514
|
+
printed but ignores any label text.
|
|
497
515
|
|
|
498
516
|
- ~-T~, ~--[no-]template~ :: Print a template of a page of labels and ignore
|
|
499
517
|
any content
|
|
500
518
|
|
|
519
|
+
**** Verbose Reporting
|
|
501
520
|
Finally, =labrat= will print a lot of information about what it's doing with
|
|
502
521
|
the ~--verbose~ or ~-v~ option. The information is printed to the standard
|
|
503
522
|
error output stream.
|
|
@@ -553,7 +572,7 @@ $ labrat -T -V --label=avery8987
|
|
|
553
572
|
|
|
554
573
|
And if you want to see it with sample label text filled in, try the following:
|
|
555
574
|
#+begin_example
|
|
556
|
-
$ labrat -V -c30 --label=avery8987 'Four score and seven years ago
|
|
575
|
+
$ labrat -V -c30 --label=avery8987 'Four score and seven years ago-->Our fathers brought forth'
|
|
557
576
|
#+end_example
|
|
558
577
|
|
|
559
578
|
*** Nesting label definitions
|
|
@@ -589,7 +608,7 @@ badge:
|
|
|
589
608
|
|
|
590
609
|
With this, you can print a file folder label with:
|
|
591
610
|
#+begin_example
|
|
592
|
-
$ labrat --label=ff 'Four score and seven years ago
|
|
611
|
+
$ labrat --label=ff 'Four score and seven years ago-->Our fathers brought forth'
|
|
593
612
|
#+end_example
|
|
594
613
|
|
|
595
614
|
And, if you want this to be your default label type, you can add to your user-level
|
|
@@ -601,13 +620,13 @@ label:
|
|
|
601
620
|
|
|
602
621
|
Now you can print the label without the ~--label~ option on the command-line:
|
|
603
622
|
#+begin_example
|
|
604
|
-
$ labrat 'Four score and seven years ago
|
|
623
|
+
$ labrat 'Four score and seven years ago-->Our fathers brought forth'
|
|
605
624
|
#+end_example
|
|
606
625
|
|
|
607
626
|
If you want to print badges, you have to specify the ~--label~ option explicitly on
|
|
608
627
|
the command-line:
|
|
609
628
|
#+begin_example
|
|
610
|
-
$ labrat -V -c14 --label=badge 'Daniel E. Doherty
|
|
629
|
+
$ labrat -V -c14 --label=badge 'Daniel E. Doherty-->(Amateur Programmer)'
|
|
611
630
|
#+end_example
|
|
612
631
|
|
|
613
632
|
*** A Caution about option order
|
|
@@ -617,7 +636,7 @@ override earlier settings. For example, given the configuration above, where
|
|
|
617
636
|
~ff~ is your default label type, the following will not do what you expect:
|
|
618
637
|
|
|
619
638
|
#+begin_example
|
|
620
|
-
$ labrat --font-style=italic --label=ff 'Four score and seven years ago
|
|
639
|
+
$ labrat --font-style=italic --label=ff 'Four score and seven years ago-->Our fathers brought forth'
|
|
621
640
|
#+end_example
|
|
622
641
|
|
|
623
642
|
You expect the label to be printed in italic, but the ~--label=ff~ option in
|
|
@@ -628,7 +647,7 @@ namely ~--font-style=bold~ from the user-level label database.
|
|
|
628
647
|
To get this to work, you have to put the command-line setting after the
|
|
629
648
|
~--label=ff~ option in order for it to take effect:
|
|
630
649
|
#+begin_example
|
|
631
|
-
$ labrat --label=ff --font-style=italic 'Four score and seven years ago
|
|
650
|
+
$ labrat --label=ff --font-style=italic 'Four score and seven years ago-->Our fathers brought forth'
|
|
632
651
|
#+end_example
|
|
633
652
|
|
|
634
653
|
* Development
|
data/bin/labrat
CHANGED
|
@@ -27,9 +27,9 @@ begin
|
|
|
27
27
|
if ops.template
|
|
28
28
|
[]
|
|
29
29
|
elsif !ops.in_file.blank?
|
|
30
|
-
Labrat.read_label_texts(ops.in_file, ops.
|
|
30
|
+
Labrat.read_label_texts(ops.in_file, ops.nl_sep)
|
|
31
31
|
elsif non_ops.empty?
|
|
32
|
-
Labrat.read_label_texts(nil, ops.
|
|
32
|
+
Labrat.read_label_texts(nil, ops.nl_sep)
|
|
33
33
|
else
|
|
34
34
|
[]
|
|
35
35
|
end
|
data/labrat.gemspec
CHANGED
|
@@ -8,7 +8,24 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.authors = ["Daniel E. Doherty"]
|
|
9
9
|
spec.email = ["ded-labrat@ddoherty.net"]
|
|
10
10
|
|
|
11
|
-
spec.summary = "
|
|
11
|
+
spec.summary = "Command-line and Emacs label print software."
|
|
12
|
+
spec.description = <<~DESC
|
|
13
|
+
|
|
14
|
+
Labrat is a linux command-line program for quickly printing labels. Labrat uses
|
|
15
|
+
the wonderful Prawn gem to generate PDF files with label formatting in mind. With
|
|
16
|
+
labrat properly configured, printing a label is as simple as:
|
|
17
|
+
|
|
18
|
+
$ labrat 'Income Taxes 2021-->Example Maker, Inc.'
|
|
19
|
+
|
|
20
|
+
And you will get a two-line file-folder label with the text centered. It can
|
|
21
|
+
print on dymo label printer rolls or Avery sheet labels. It knows the layout of
|
|
22
|
+
most Avery label types.
|
|
23
|
+
|
|
24
|
+
For Emacs users, labrat includes elisp code for invoking labrat from within a
|
|
25
|
+
buffer, providing a quick way to print labels.
|
|
26
|
+
|
|
27
|
+
DESC
|
|
28
|
+
|
|
12
29
|
spec.homepage = "http://github.com/ddoherty03/labrat"
|
|
13
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
|
14
31
|
|
|
@@ -25,15 +42,16 @@ Gem::Specification.new do |spec|
|
|
|
25
42
|
spec.executables = spec.files.grep(%r{\Abin/labrat}) { |f| File.basename(f) }
|
|
26
43
|
spec.require_paths = ["lib"]
|
|
27
44
|
spec.post_install_message = 'To install config and label database files, run [sudo] labrat-install.'
|
|
45
|
+
spec.add_dependency "matrix"
|
|
28
46
|
spec.add_dependency "prawn", "~> 2.0"
|
|
29
47
|
spec.add_dependency "activesupport"
|
|
30
48
|
spec.add_dependency "fat_core"
|
|
31
49
|
|
|
32
|
-
# Note: pry-byebug requires that pry be within the '0.13.0' version box.
|
|
33
50
|
spec.add_development_dependency 'rake'
|
|
34
51
|
spec.add_development_dependency 'rspec'
|
|
35
|
-
spec.add_development_dependency 'pry'
|
|
36
|
-
spec.add_development_dependency '
|
|
52
|
+
spec.add_development_dependency 'pry'
|
|
53
|
+
spec.add_development_dependency 'simplecov'
|
|
54
|
+
spec.add_development_dependency 'debug', '>= 1.0.0'
|
|
37
55
|
spec.add_development_dependency 'rubocop-performance'
|
|
38
56
|
spec.add_development_dependency 'rubocop-shopify'
|
|
39
57
|
spec.add_development_dependency 'rubocop-rspec'
|
data/lib/config_files/config.yml
CHANGED
|
@@ -93,7 +93,12 @@
|
|
|
93
93
|
# A string sequence that is interpreted as a line-break can be defined. Such
|
|
94
94
|
# a sequence is particularly helpful when you provide the label text on the
|
|
95
95
|
# command-line, though it will be applied to file-read label texts as well.
|
|
96
|
-
# nlsep: '
|
|
96
|
+
# nlsep: '-->'
|
|
97
|
+
|
|
98
|
+
# A string sequence that indicates the start of a new label. Such a sequence
|
|
99
|
+
# is particularly helpful when you provide the label text on the command-line,
|
|
100
|
+
# though it will be applied to file-read label texts as well.
|
|
101
|
+
# label-sep: '==>'
|
|
97
102
|
|
|
98
103
|
# The name of the printer to use in substituting for the %p placeholder in the
|
|
99
104
|
# print-command setting below.
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
# out-file, etc., only things such as page and label dimensions that would
|
|
4
4
|
# apply to all users of a particular label type.
|
|
5
5
|
|
|
6
|
+
# 19.9x87.29mm
|
|
6
7
|
dymo30327:
|
|
7
|
-
page-width:
|
|
8
|
+
page-width: 25mm
|
|
8
9
|
page-height: 87mm
|
|
9
10
|
rows: 1
|
|
10
11
|
columns: 1
|
|
@@ -12,10 +13,10 @@ dymo30327:
|
|
|
12
13
|
bottom-page-margin: 0mm
|
|
13
14
|
left-page-margin: 5mm
|
|
14
15
|
right-page-margin: 5mm
|
|
15
|
-
top-pad:
|
|
16
|
-
bottom-pad:
|
|
17
|
-
left-pad:
|
|
18
|
-
right-pad:
|
|
16
|
+
top-pad: 1mm
|
|
17
|
+
bottom-pad: 1mm
|
|
18
|
+
left-pad: 1mm
|
|
19
|
+
right-pad: 1mm
|
|
19
20
|
landscape: true
|
|
20
21
|
|
|
21
22
|
duraready1034D:
|
|
@@ -208,7 +209,7 @@ avery5163:
|
|
|
208
209
|
column-gap: 5mm
|
|
209
210
|
landscape: false
|
|
210
211
|
|
|
211
|
-
avery15513
|
|
212
|
+
avery15513:
|
|
212
213
|
label: avery5163
|
|
213
214
|
|
|
214
215
|
label: avery5163
|
data/lib/labrat/arg_parser.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Labrat
|
|
|
20
20
|
# Parse and set the options object to reflect the values of the given
|
|
21
21
|
# args, after merging in any prior settings into options. Return the
|
|
22
22
|
# resulting options instance. The args argument can be either a Hash or,
|
|
23
|
-
# as usual, an Array of Strings from the command-line.
|
|
23
|
+
# as usual, an Array of Strings from the command-line. Throw an exception
|
|
24
24
|
# for errors encountered parsing the args.
|
|
25
25
|
def parse(args, prior: {}, verbose: false)
|
|
26
26
|
options.msg = nil
|
|
@@ -48,7 +48,7 @@ module Labrat
|
|
|
48
48
|
parser.separator ""
|
|
49
49
|
parser.separator "Print or view (with -V) a label with the given <label-text>."
|
|
50
50
|
parser.separator "All non-option arguments are used for the label text with a special"
|
|
51
|
-
parser.separator "marker ('
|
|
51
|
+
parser.separator "marker ('-->' by default, see --nlsep) indicating a line-break."
|
|
52
52
|
parser.separator ""
|
|
53
53
|
parser.separator "Below, NUM indicates an integer, DIM, indicates a linear dimension,"
|
|
54
54
|
parser.separator "valid DIM units are: pt, mm, cm, dm, m, in, ft, yd."
|
|
@@ -198,8 +198,10 @@ module Labrat
|
|
|
198
198
|
# of common labels with their dimensions, so that --width and --height
|
|
199
199
|
# need not be specified.
|
|
200
200
|
def label_name_option
|
|
201
|
+
# options.raw_label = nil
|
|
201
202
|
parser.on("-lNAME", "--label=NAME",
|
|
202
203
|
"Use options for label type NAME from label database") do |name|
|
|
204
|
+
options.raw_label ||= name
|
|
203
205
|
if labels_seen.include?(name)
|
|
204
206
|
msg = "label option '#{name}' has circular reference"
|
|
205
207
|
labels_seen.each do |nm|
|
|
@@ -236,8 +238,17 @@ module Labrat
|
|
|
236
238
|
warn "#{p}\n"
|
|
237
239
|
end
|
|
238
240
|
warn "\nKnown labels:\n"
|
|
239
|
-
lab_names.
|
|
240
|
-
|
|
241
|
+
max_width = lab_names.max_by(&:length).length
|
|
242
|
+
ngrps = (78 / (max_width + 1)).floor
|
|
243
|
+
|
|
244
|
+
lab_names.sort_by do |nm|
|
|
245
|
+
nm.match(/\A([a-zA-z]+)([0-9]+)?/)
|
|
246
|
+
[$1, $2.to_i || 0]
|
|
247
|
+
end
|
|
248
|
+
.groups_of(ngrps).each do |_n, grp|
|
|
249
|
+
fmt = "%-#{max_width+1}s"
|
|
250
|
+
grp = grp.map{|nm| sprintf(fmt, nm) }
|
|
251
|
+
warn " #{grp.join(' ')}"
|
|
241
252
|
end
|
|
242
253
|
end
|
|
243
254
|
exit(0)
|
|
@@ -350,11 +361,11 @@ module Labrat
|
|
|
350
361
|
|
|
351
362
|
# On a command-line, specifying where a line-break should occur is not
|
|
352
363
|
# convenient when shell interpretation and quoting rules are taken into
|
|
353
|
-
# account. This allows the user to use some distinctive marker ('
|
|
364
|
+
# account. This allows the user to use some distinctive marker ('-->' by
|
|
354
365
|
# default) to designate where a line break should occur.
|
|
355
366
|
def nl_sep_option
|
|
356
367
|
parser.on("-nSEP", "--nl-sep=SEPARATOR",
|
|
357
|
-
"Specify text to be translated into a line-break (default '
|
|
368
|
+
"Specify text to be translated into a line-break (default '-->')") do |nl|
|
|
358
369
|
options.nl_sep = nl
|
|
359
370
|
warn " ::nl-sep <- '#{nl}'::" if options.verbose
|
|
360
371
|
end
|
|
@@ -365,7 +376,7 @@ module Labrat
|
|
|
365
376
|
# designate where a new label shoul be started.
|
|
366
377
|
def label_sep_option
|
|
367
378
|
parser.on("--label-sep=SEPARATOR",
|
|
368
|
-
"Specify text that indicates the start of a new label (default '
|
|
379
|
+
"Specify text that indicates the start of a new label (default '==>')") do |ls|
|
|
369
380
|
options.label-sep = ls
|
|
370
381
|
warn " ::label-sep <- '#{ls}'::" if options.verbose
|
|
371
382
|
end
|
data/lib/labrat/config.rb
CHANGED
|
@@ -71,8 +71,15 @@ module Labrat
|
|
|
71
71
|
files.each do |f|
|
|
72
72
|
next unless File.readable?(f)
|
|
73
73
|
|
|
74
|
-
yml_hash = YAML.load(File.read(f))
|
|
75
|
-
|
|
74
|
+
yml_hash = YAML.load(File.read(f))
|
|
75
|
+
next unless yml_hash
|
|
76
|
+
|
|
77
|
+
if yml_hash.is_a?(Hash)
|
|
78
|
+
yml_hash = yml_hash.methodize
|
|
79
|
+
else
|
|
80
|
+
raise "Error loading file #{f}:\n#{File.read(f)[0..500]}"
|
|
81
|
+
end
|
|
82
|
+
yml_hash.report("Merging config from file '#{f}") if verbose
|
|
76
83
|
hash.deep_merge!(yml_hash)
|
|
77
84
|
end
|
|
78
85
|
hash
|
data/lib/labrat/label.rb
CHANGED
|
@@ -57,11 +57,15 @@ module Labrat
|
|
|
57
57
|
warn ""
|
|
58
58
|
end
|
|
59
59
|
if ops.template
|
|
60
|
-
# Replace any texts with the numbers and show the grid.
|
|
61
|
-
|
|
60
|
+
# Replace any texts with the numbers, the name of the label (and alias) and show the grid.
|
|
61
|
+
lab_text = ops.raw_label || ops.label
|
|
62
|
+
if ops.label != ops.raw_label
|
|
63
|
+
lab_text += "\n(#{ops.label})"
|
|
64
|
+
end
|
|
65
|
+
self.texts = (1..(ops.rows * ops.columns)).map {|n| "#{n}\n#{lab_text}"}
|
|
62
66
|
ops.font_name = 'Helvetica'
|
|
63
67
|
ops.font_style = 'bold'
|
|
64
|
-
ops.font_size =
|
|
68
|
+
ops.font_size = 11
|
|
65
69
|
pdf.grid.show_all
|
|
66
70
|
end
|
|
67
71
|
raise EmptyLabelError, "Empty label" if waste_of_labels?
|
data/lib/labrat/options.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Labrat
|
|
|
6
6
|
# and perhaps environment. An Options instance can be handed off to the
|
|
7
7
|
# label-printing objects to inform its formatting, printing, etc.
|
|
8
8
|
class Options
|
|
9
|
-
attr_accessor :label, :page_width, :page_height,
|
|
9
|
+
attr_accessor :label, :raw_label, :page_width, :page_height,
|
|
10
10
|
:left_page_margin, :right_page_margin,
|
|
11
11
|
:top_page_margin, :bottom_page_margin,
|
|
12
12
|
:rows, :columns, :row_gap, :column_gap, :landscape,
|
|
@@ -22,6 +22,7 @@ module Labrat
|
|
|
22
22
|
# Initialize with an optional hash of default values for the attributes.
|
|
23
23
|
def initialize(**init)
|
|
24
24
|
self.label = init[:label] || nil
|
|
25
|
+
self.raw_label = nil
|
|
25
26
|
# Per-page attributes
|
|
26
27
|
self.page_width = init[:page_width] || 24.mm
|
|
27
28
|
self.page_height = init[:page_height] || 87.mm
|
|
@@ -49,8 +50,8 @@ module Labrat
|
|
|
49
50
|
self.font_size = init[:font_size] || 12
|
|
50
51
|
# Input attributes
|
|
51
52
|
self.in_file = init[:in_file] || nil
|
|
52
|
-
self.nl_sep = init[:nl_sep] || '
|
|
53
|
-
self.label_sep = init[:label_sep] || '
|
|
53
|
+
self.nl_sep = init[:nl_sep] || '-->'
|
|
54
|
+
self.label_sep = init[:label_sep] || '==>'
|
|
54
55
|
self.copies = init[:copies] || 1
|
|
55
56
|
# Output attributes
|
|
56
57
|
self.printer = init[:printer] || ENV['LABRAT_PRINTER'] || ENV['PRINTER'] || 'dymo'
|
|
@@ -84,6 +85,8 @@ module Labrat
|
|
|
84
85
|
end
|
|
85
86
|
warn ""
|
|
86
87
|
end
|
|
88
|
+
# We want raw_label to reflect what the user typed on the command-line
|
|
89
|
+
file_options.raw_label = nil
|
|
87
90
|
Labrat::ArgParser.new.parse(args, prior: file_options, verbose: verbose)
|
|
88
91
|
end
|
|
89
92
|
|
|
@@ -124,6 +127,7 @@ module Labrat
|
|
|
124
127
|
def to_hash
|
|
125
128
|
{
|
|
126
129
|
label: label,
|
|
130
|
+
raw_label: raw_label,
|
|
127
131
|
page_width: page_width,
|
|
128
132
|
page_height: page_height,
|
|
129
133
|
left_page_margin: left_page_margin,
|
data/lib/labrat/version.rb
CHANGED
data/lib/labrat.rb
CHANGED
data/lib/lisp/labrat.el
CHANGED
|
@@ -22,7 +22,7 @@ e.g. ~/.rbenv/shims/labrat, for an rbenv ruby installation."
|
|
|
22
22
|
:type 'string
|
|
23
23
|
:group 'labrat)
|
|
24
24
|
|
|
25
|
-
(defcustom labrat-nl-sep "
|
|
25
|
+
(defcustom labrat-nl-sep "-->"
|
|
26
26
|
"String to mark newlines in label text.
|
|
27
27
|
|
|
28
28
|
If you change this, you need to make a corresponding change in your
|
|
@@ -30,7 +30,7 @@ labrat configuration at ~/.config/labrat/config.yml."
|
|
|
30
30
|
:type 'string
|
|
31
31
|
:group 'labrat)
|
|
32
32
|
|
|
33
|
-
(defcustom labrat-label-sep "
|
|
33
|
+
(defcustom labrat-label-sep "==>"
|
|
34
34
|
"String to mark the separation between labels on the labrat command-line.
|
|
35
35
|
|
|
36
36
|
If you change this, you need to make a corresponding change in your
|
|
@@ -88,10 +88,10 @@ returned"
|
|
|
88
88
|
This invokes the \"labrat -V\ <label>\" command with the
|
|
89
89
|
paragraph at or before point inserted in the <label> position,
|
|
90
90
|
but with each new-line replaced with the value of the variable
|
|
91
|
-
labrat-nl-sep, '
|
|
91
|
+
labrat-nl-sep, '-->' by default."
|
|
92
92
|
(interactive)
|
|
93
|
-
(call-process labrat-executable nil
|
|
94
|
-
"-V" (labrat/pars-in-region)))
|
|
93
|
+
(call-process labrat-executable nil (get-buffer-create "*labrat*") nil
|
|
94
|
+
"-V" "-o ~/labrat.pdf""-V --out-file=~/labrat.pdf" (labrat/pars-in-region)))
|
|
95
95
|
|
|
96
96
|
(defun labrat-print ()
|
|
97
97
|
"Print the paragraph at or before point as a label with labrat.
|
|
@@ -99,10 +99,10 @@ labrat-nl-sep, '++' by default."
|
|
|
99
99
|
This invokes the \"labrat -P <label>\" command with the paragraph
|
|
100
100
|
at or before point inserted in the <label> position, but with
|
|
101
101
|
each new-line replaced with the value of the variable
|
|
102
|
-
labrat-nl-sep, '
|
|
102
|
+
labrat-nl-sep, '-->' by default."
|
|
103
103
|
(interactive)
|
|
104
|
-
(call-process labrat-executable nil
|
|
105
|
-
(labrat/pars-in-region)))
|
|
104
|
+
(call-process labrat-executable nil (buffer-name (get-buffer-create "*labrat*")) nil
|
|
105
|
+
"-o ~/labrat.pdf" (labrat/pars-in-region)))
|
|
106
106
|
|
|
107
107
|
(provide 'labrat)
|
|
108
108
|
;;; labrat.el ends here
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: labrat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel E. Doherty
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: matrix
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: prawn
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -84,30 +98,44 @@ dependencies:
|
|
|
84
98
|
name: pry
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
86
100
|
requirements:
|
|
87
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: simplecov
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
88
116
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0
|
|
117
|
+
version: '0'
|
|
90
118
|
type: :development
|
|
91
119
|
prerelease: false
|
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
121
|
requirements:
|
|
94
|
-
- - "
|
|
122
|
+
- - ">="
|
|
95
123
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0
|
|
124
|
+
version: '0'
|
|
97
125
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
126
|
+
name: debug
|
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
|
100
128
|
requirements:
|
|
101
129
|
- - ">="
|
|
102
130
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
131
|
+
version: 1.0.0
|
|
104
132
|
type: :development
|
|
105
133
|
prerelease: false
|
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
135
|
requirements:
|
|
108
136
|
- - ">="
|
|
109
137
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
138
|
+
version: 1.0.0
|
|
111
139
|
- !ruby/object:Gem::Dependency
|
|
112
140
|
name: rubocop-performance
|
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,7 +178,21 @@ dependencies:
|
|
|
150
178
|
- - ">="
|
|
151
179
|
- !ruby/object:Gem::Version
|
|
152
180
|
version: '0'
|
|
153
|
-
description:
|
|
181
|
+
description: |2+
|
|
182
|
+
|
|
183
|
+
Labrat is a linux command-line program for quickly printing labels. Labrat uses
|
|
184
|
+
the wonderful Prawn gem to generate PDF files with label formatting in mind. With
|
|
185
|
+
labrat properly configured, printing a label is as simple as:
|
|
186
|
+
|
|
187
|
+
$ labrat 'Income Taxes 2021-->Example Maker, Inc.'
|
|
188
|
+
|
|
189
|
+
And you will get a two-line file-folder label with the text centered. It can
|
|
190
|
+
print on dymo label printer rolls or Avery sheet labels. It knows the layout of
|
|
191
|
+
most Avery label types.
|
|
192
|
+
|
|
193
|
+
For Emacs users, labrat includes elisp code for invoking labrat from within a
|
|
194
|
+
buffer, providing a quick way to print labels.
|
|
195
|
+
|
|
154
196
|
email:
|
|
155
197
|
- ded-labrat@ddoherty.net
|
|
156
198
|
executables:
|
|
@@ -162,10 +204,12 @@ files:
|
|
|
162
204
|
- ".gitignore"
|
|
163
205
|
- ".rspec"
|
|
164
206
|
- ".rubocop.yml"
|
|
207
|
+
- ".simplecov"
|
|
165
208
|
- ".travis.yml"
|
|
166
209
|
- CHANGELOG.md
|
|
167
210
|
- Gemfile
|
|
168
211
|
- Gemfile.lock
|
|
212
|
+
- Notes.org
|
|
169
213
|
- README.org
|
|
170
214
|
- Rakefile
|
|
171
215
|
- TODO.org
|
|
@@ -212,8 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
212
256
|
- !ruby/object:Gem::Version
|
|
213
257
|
version: '0'
|
|
214
258
|
requirements: []
|
|
215
|
-
rubygems_version: 3.
|
|
216
|
-
signing_key:
|
|
259
|
+
rubygems_version: 3.4.1
|
|
260
|
+
signing_key:
|
|
217
261
|
specification_version: 4
|
|
218
|
-
summary:
|
|
262
|
+
summary: Command-line and Emacs label print software.
|
|
219
263
|
test_files: []
|