labrat 1.6.0 → 1.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ce9676af6fe2c1155bd75cdae1dc61e6b0a8875408340a53ab0b8cbef18b6b3
4
- data.tar.gz: 313c7fc8caaac101a427e2e8f8f707e12dd2355fef59445c8f133eeba3caa834
3
+ metadata.gz: f11f068132dd2805175cef812bd83b0fb881946327b96bd37a06155f54f465f6
4
+ data.tar.gz: 8a7629f288a9a3250e5c3afeb9be81acb345445f204f27abcbfeee7512af7cb5
5
5
  SHA512:
6
- metadata.gz: 36b1daaa10a3bd14688ad0eaecdcee97afdc9e5bc2511a33a43346b63f3335e0d4c2111ec96144055fca72a84d5ce83e51fc6c9ae2347c360e13f74966f6e0ce
7
- data.tar.gz: f24a79df4d77e682be68c1fecf709214250b050665eddd85353026b4358cdaa6aa8e771bed16f4ee6eb901ac7ff54e815bdf1f9fa52c6310ea913993b816d4e8
6
+ metadata.gz: 6a092cf31d6b5e122988ecf863ab456c7a50b216aca9175a1b89129d8b31c7e6ce480eba2f8470f1d9a3d32c478ba7c8f873910b7226baa94cf03f4b09aeccf4
7
+ data.tar.gz: 3d9a1fa79f6c70637d7814b472bbb9ee609fadb94705766d232be5e92eb3b452ed7a8c58f27d422432bc2e98c34cda05dc3676d3d1c180268d6d843f54cb7bc1
@@ -14,10 +14,13 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  ruby:
17
- - '3.3.5'
17
+ - '3.2'
18
+ - '3.3'
19
+ - '3.4'
20
+ - '4.0'
18
21
 
19
22
  steps:
20
- - uses: actions/checkout@v4
23
+ - uses: actions/checkout@v7
21
24
  - name: Set up Ruby
22
25
  uses: ruby/setup-ruby@v1
23
26
  with:
data/CHANGELOG.md CHANGED
@@ -1,16 +1,24 @@
1
- - [Version 1.6.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-03-06 Fri]</span></span>](#org0072ea7)
2
- - [Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>](#org309b509)
3
- - [Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>](#orgcd48f5d)
4
- - [Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>](#orgd671ebe)
5
- - [Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>](#org55a1d4d)
6
- - [Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>](#org89e5245)
7
- - [Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>](#orgeed739d)
8
- - [Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>](#orgadd5092)
9
- - [Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>](#org25c7986)
10
- - [Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>](#org2d49d11)
1
+ - [Version 1.7.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-09-20 Sun]</span></span>](#org6f0ed48)
2
+ - [Version 1.6.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-03-06 Fri]</span></span>](#orga90e5bb)
3
+ - [Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>](#org7c8e446)
4
+ - [Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>](#orga376b97)
5
+ - [Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>](#org2e73608)
6
+ - [Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>](#org1c5c6f7)
7
+ - [Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>](#org45d96d4)
8
+ - [Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>](#org0e5726b)
9
+ - [Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>](#org055ad15)
10
+ - [Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>](#orgb3e1e30)
11
+ - [Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>](#org5a4e73b)
11
12
 
12
13
 
13
- <a id="org0072ea7"></a>
14
+ <a id="org6f0ed48"></a>
15
+
16
+ # Version 1.7.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-09-20 Sun]</span></span>
17
+
18
+ - Added a new &ndash;print-option config to pass printer config options to the print-command.
19
+
20
+
21
+ <a id="orga90e5bb"></a>
14
22
 
15
23
  # Version 1.6.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-03-06 Fri]</span></span>
16
24
 
@@ -20,14 +28,14 @@
20
28
  - Fix use of XDG\_DATA\_HOME environment variable.
21
29
 
22
30
 
23
- <a id="org309b509"></a>
31
+ <a id="org7c8e446"></a>
24
32
 
25
33
  # Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>
26
34
 
27
35
  - Added a `vim` plugin to allow printing or viewing labels from within a vim buffer as was possible in Emacs with `labrat.el`.
28
36
 
29
37
 
30
- <a id="orgcd48f5d"></a>
38
+ <a id="orga376b97"></a>
31
39
 
32
40
  # Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>
33
41
 
@@ -35,28 +43,28 @@
35
43
  - Output file can still be overridden with the `-o` or `--out-file` option
36
44
 
37
45
 
38
- <a id="orgd671ebe"></a>
46
+ <a id="org2e73608"></a>
39
47
 
40
48
  # Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>
41
49
 
42
50
  - No user-visible changes
43
51
 
44
52
 
45
- <a id="org55a1d4d"></a>
53
+ <a id="org1c5c6f7"></a>
46
54
 
47
55
  # Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>
48
56
 
49
57
  - Used `fat_config` gem to read config files
50
58
 
51
59
 
52
- <a id="org89e5245"></a>
60
+ <a id="org45d96d4"></a>
53
61
 
54
62
  # Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>
55
63
 
56
64
  - Fixed `labrat.el` view command
57
65
 
58
66
 
59
- <a id="orgeed739d"></a>
67
+ <a id="org0e5726b"></a>
60
68
 
61
69
  # Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>
62
70
 
@@ -65,23 +73,23 @@
65
73
  - Minor bug fixes
66
74
 
67
75
 
68
- <a id="orgadd5092"></a>
76
+ <a id="org055ad15"></a>
69
77
 
70
78
  # Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>
71
79
 
72
- - Changed `nl-sep` to '&#x2013;>'
80
+ - Changed `nl-sep` to '&ndash;>'
73
81
  - Changed `label-sep` to '==>'
74
82
  - Added label name to template output
75
83
 
76
84
 
77
- <a id="org25c7986"></a>
85
+ <a id="orgb3e1e30"></a>
78
86
 
79
87
  # Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>
80
88
 
81
89
  - Nothing important
82
90
 
83
91
 
84
- <a id="org2d49d11"></a>
92
+ <a id="org5a4e73b"></a>
85
93
 
86
94
  # Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>
87
95
 
data/CHANGELOG.org CHANGED
@@ -1,4 +1,7 @@
1
1
 
2
+ * Version 1.7.0 [2026-09-20 Sun]
3
+ - Added a new --print-option config to pass printer config options to the print-command.
4
+
2
5
  * Version 1.6.0 [2026-03-06 Fri]
3
6
  - Improved labrat.el to ensure that the *labrat* buffer gets created and logs
4
7
  the command used along with a timestamp and any errors.
data/Gemfile CHANGED
@@ -5,9 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in labrat.gemspec
6
6
  gemspec
7
7
 
8
- # Force the pre-bigdecimal-dep ttfunk so prawn can load even if bigdecimal 4.x is around
9
- gem "ttfunk", "1.7.0"
10
-
11
8
  group :development do
12
9
  gem 'debug', '>= 1.0.0'
13
10
  gem 'gem_docs', '>=0.3.1'
data/Gemfile.lock CHANGED
@@ -12,8 +12,9 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- labrat (1.6.0)
15
+ labrat (1.7.0)
16
16
  activesupport
17
+ bigdecimal (~> 3.1)
17
18
  fat_config (>= 0.4.2)
18
19
  matrix
19
20
  prawn (<= 2.5)
@@ -170,7 +171,8 @@ GEM
170
171
  tomlib (0.7.3)
171
172
  bigdecimal
172
173
  tsort (0.2.0)
173
- ttfunk (1.7.0)
174
+ ttfunk (1.8.0)
175
+ bigdecimal (~> 3.1)
174
176
  tzinfo (2.0.6)
175
177
  concurrent-ruby (~> 1.0)
176
178
  unicode-display_width (3.2.0)
@@ -193,7 +195,6 @@ DEPENDENCIES
193
195
  rubocop
194
196
  rubocop-ddoherty!
195
197
  simplecov
196
- ttfunk (= 1.7.0)
197
198
 
198
199
  CHECKSUMS
199
200
  activesupport (8.1.2) sha256=88842578ccd0d40f658289b0e8c842acfe9af751afee2e0744a7873f50b6fdae
@@ -220,7 +221,7 @@ CHECKSUMS
220
221
  irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae
221
222
  json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
222
223
  json-schema (6.1.0) sha256=6bf70a2cfb6dfd5a06da28093fa8190f324c88eabd36a7f47097f227321dc702
223
- labrat (1.6.0)
224
+ labrat (1.7.0)
224
225
  language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
225
226
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
226
227
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
@@ -265,7 +266,7 @@ CHECKSUMS
265
266
  stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
266
267
  tomlib (0.7.3) sha256=85e562eeaa40b2aca552a13515f41fc6ae9dc522154bc1089c8d3ef94dcebd9b
267
268
  tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
268
- ttfunk (1.7.0) sha256=2370ba484b1891c70bdcafd3448cfd82a32dd794802d81d720a64c15d3ef2a96
269
+ ttfunk (1.8.0) sha256=a7cbc7e489cc46e979dde04d34b5b9e4f5c8f1ee5fc6b1a7be39b829919d20ca
269
270
  tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
270
271
  unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
271
272
  unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Daniel E. Doherty
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,47 +1,48 @@
1
- - [Introduction](#org73b5965)
2
- - [Motivation](#orgbc2f216)
3
- - [Quick Start](#orgc6ae3c0)
4
- - [Installation](#orgba29739)
5
- - [Editor Integration](#org5254d08)
6
- - [Emacs](#orgc20ef04)
7
- - [Vim](#org56f5d71)
8
- - [Installing the Libraries](#org38d07ba)
9
- - [A Tip on Buying File Folder Labels](#orge05db22)
10
- - [Usage](#orgfe955c0)
11
- - [Setting options](#orgaaf8f48)
12
- - [Dimensions and other values in options](#org73003a4)
13
- - [Page Setup Options](#orgc698d7b)
14
- - [Orientation](#org673748d)
15
- - [Page Dimensions](#orga97a775)
16
- - [Page Grid](#orge513fa5)
17
- - [Label Setup Options](#orgb0d154a)
18
- - [Padding](#org7405c33)
19
- - [Alignment](#org2181c47)
20
- - [Fonts and styling](#org34b3ec2)
21
- - [Position Adjustment](#org3b0bd36)
22
- - [Job Processing Options](#org687b5fe)
23
- - [Starting label](#org9f88ae2)
24
- - [New line marker](#org038b8d4)
25
- - [Label separator](#orgabdfba3)
26
- - [Number of copies](#org03365b1)
27
- - [Input and output files](#orgab3df6b)
28
- - [Printing or viewing](#orgc737bdb)
29
- - [Printing and viewing shell commands](#org5fbf44a)
30
- - [Aids to testing label layouts](#org5383ea7)
31
- - [The Label Database and the label option](#org43755ad)
32
- - [Listing labels](#org47479ac)
33
- - [System label database](#orga53002b)
34
- - [Trying out a label definition](#org1ee27db)
35
- - [Nesting label definitions](#org3e9c72c)
36
- - [Label database entries as configuration sets](#org9db78c7)
37
- - [A Caution about option order](#orgba4a7ec)
38
- - [Development](#org480b590)
39
- - [Contributing](#orgf644906)
1
+ - [Introduction](#org37ca0bf)
2
+ - [Motivation](#orgfd3eab2)
3
+ - [Quick Start](#org3ec8208)
4
+ - [Installation](#org461a38d)
5
+ - [Editor Integration](#org4fb5a72)
6
+ - [Emacs](#orgdf5ee68)
7
+ - [Vim](#org765c550)
8
+ - [Installing the Libraries](#org76f2999)
9
+ - [A Tip on Buying File Folder Labels](#orge259885)
10
+ - [Usage](#orgc58f1b7)
11
+ - [Setting options](#org64b7efa)
12
+ - [Dimensions and other values in options](#org6e2ad7d)
13
+ - [Page Setup Options](#org0e486f5)
14
+ - [Orientation](#orgdbf03d2)
15
+ - [Page Dimensions](#org5cf4cb6)
16
+ - [Page Grid](#org5a2bf0a)
17
+ - [Label Setup Options](#orgf598b9b)
18
+ - [Padding](#org33fedfd)
19
+ - [Alignment](#orgd4ff68f)
20
+ - [Fonts and styling](#orgd037ada)
21
+ - [Position Adjustment](#orgf8d7ac5)
22
+ - [Job Processing Options](#orgf810ded)
23
+ - [Starting label](#org6edabda)
24
+ - [New line marker](#org7da27f4)
25
+ - [Label separator](#orgd2462ca)
26
+ - [Number of copies](#org429b3fa)
27
+ - [Input and output files](#org664db30)
28
+ - [Printing or viewing](#org079e818)
29
+ - [Printing and viewing shell commands](#org8834ee6)
30
+ - [Print Options](#orgbd5e973)
31
+ - [Aids to testing label layouts](#orgf5aedaf)
32
+ - [The Label Database and the label option](#org3b44ec8)
33
+ - [Listing labels](#org1e6d591)
34
+ - [System label database](#org3efa50e)
35
+ - [Trying out a label definition](#org20918c3)
36
+ - [Nesting label definitions](#orgd676030)
37
+ - [Label database entries as configuration sets](#orgde87b9d)
38
+ - [A Caution about option order](#org1e209d8)
39
+ - [Development](#org2018651)
40
+ - [Contributing](#org15803f7)
40
41
 
41
42
  [![CI](https://github.com/ddoherty03/labrat/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/ddoherty03/labrat/actions/workflows/main.yml)
42
43
 
43
44
 
44
- <a id="org73b5965"></a>
45
+ <a id="org37ca0bf"></a>
45
46
 
46
47
  # Introduction
47
48
 
@@ -56,18 +57,18 @@ Easy-to-print labels can make the process of creating file folders trivial, but
56
57
  Buy your copy today while supplies last!
57
58
 
58
59
 
59
- <a id="orgbc2f216"></a>
60
+ <a id="orgfd3eab2"></a>
60
61
 
61
62
  # Motivation
62
63
 
63
64
  I need to print labels. And in my case, mostly I need file folder labels. I typically want to print to a Dymo LabelWriter, of which I own several variants. The problem is that I work almost entirely in Linux, but the simple task of printing a file folder label has required opening a GUI application, such as the very fine [glabels](https://help.gnome.org/users/glabels/stable/), or worse, switching to a machine running Windows or to a Mac to run Dymo's proprietary GUI. The Dymo GUI is particularly irksome because it takes a long time to start up and demands that you register every time you open it.
64
65
 
65
66
 
66
- <a id="orgc6ae3c0"></a>
67
+ <a id="org3ec8208"></a>
67
68
 
68
69
  # Quick Start
69
70
 
70
- That's too much ceremony for generating simple labels. I wanted a way to print a file label from the command line, or even better, from within my editor, Emacs. After giving up looking for such a thing without success, I decided to write my own. Hence labrat. With it&#x2014;after due configuration&#x2014;printing a file folder label is as simple as:
71
+ That's too much ceremony for generating simple labels. I wanted a way to print a file label from the command line, or even better, from within my editor, Emacs. After giving up looking for such a thing without success, I decided to write my own. Hence labrat. With it&mdash;after due configuration&mdash;printing a file folder label is as simple as:
71
72
 
72
73
  ```sh
73
74
  $ labrat 'First Line of Label ~~ And the Second Line'
@@ -80,7 +81,7 @@ $ labrat -V 'First Line of Label ~~ And the Second Line'
80
81
  ```
81
82
 
82
83
 
83
- <a id="orgba29739"></a>
84
+ <a id="org461a38d"></a>
84
85
 
85
86
  # Installation
86
87
 
@@ -100,29 +101,29 @@ This will, assuming you have sudo privileges, install an annotated system-wide c
100
101
 
101
102
  It will also install an annotated sample user config file in `~/.config/labrat/labrat.yml` and a sample user-level label database in `~/.config/labrat/labeldb.yml`.
102
103
 
103
- If you invoke `labrat-install` multiple times, it will refuse to overwrite any existing config or database files that you may have already installed. If you want to re-install them you have to remove the existing files or move them out of the way.
104
+ If you invoke `labrat-install` multiple times, it will refuse to overwrite any existing config or database files that you may have already installed. If you want to re-install them you first have to remove the existing files or move them out of the way.
104
105
 
105
106
 
106
- <a id="org5254d08"></a>
107
+ <a id="org4fb5a72"></a>
107
108
 
108
109
  # Editor Integration
109
110
 
110
111
 
111
- <a id="orgc20ef04"></a>
112
+ <a id="orgdf5ee68"></a>
112
113
 
113
114
  ## Emacs
114
115
 
115
116
  Included with `labrat` is an elisp file (`labrat.el`) that will invoke `labrat` to form a label with the text of the paragraph at or before point. So within Emacs, you can bind keys to the commands, `labrat-print` and `labrat-view` to print or view the current or prior paragraph as your default label. Thus, in Emacs, I have `C-z C-l C-l` bound to `labrat-print` and `C-z C-l C-v` to `labrat-view`, and I can type a label in any buffer and get it generated with very little ceremony.
116
117
 
117
118
 
118
- <a id="org56f5d71"></a>
119
+ <a id="org765c550"></a>
119
120
 
120
121
  ## Vim
121
122
 
122
- There is also a vim plugin that you can copy to you `~.vim/plugins/labrat.vim` directory to invoke `labrat` from within `vim`. Suggested keybindings are included for copying to `~/.vim/after/plugin/labrat.vim` that bind `<leader>lp` and `<leader>lv` to invoke `labrat` in normal and visual modes.
123
+ There is also a vim plugin that you can copy to you `~/.vim/plugins/labrat.vim` directory to invoke `labrat` from within `vim`. Suggested keybindings are included for copying to `~/.vim/after/plugin/labrat.vim` that bind `<leader>lp` and `<leader>lv` to invoke `labrat` in normal and visual modes.
123
124
 
124
125
 
125
- <a id="org38d07ba"></a>
126
+ <a id="org76f2999"></a>
126
127
 
127
128
  ## Installing the Libraries
128
129
 
@@ -150,7 +151,7 @@ $ ln -s ~/.config/labrat/vim/after/plugin/labrat.vim labrat.vim
150
151
  ```
151
152
 
152
153
 
153
- <a id="orge05db22"></a>
154
+ <a id="orge259885"></a>
154
155
 
155
156
  # A Tip on Buying File Folder Labels
156
157
 
@@ -163,7 +164,7 @@ After looking for alternative printers, I found the solution, not in a new print
163
164
  Thermal labels may be fine for ephemeral applications like name tags or shipping labels, but are terrible for long-term applications like file folders, marking cables, marking electrical breakers, or any other number of applications where long-term readability is essential.
164
165
 
165
166
 
166
- <a id="orgfe955c0"></a>
167
+ <a id="orgc58f1b7"></a>
167
168
 
168
169
  # Usage
169
170
 
@@ -180,7 +181,7 @@ And you will get a two-line file-folder label printed that looks like this:
180
181
  Note that an outline was added to make the size of the label apparent and is not actually printed with the label by default.
181
182
 
182
183
 
183
- <a id="orgaaf8f48"></a>
184
+ <a id="org64b7efa"></a>
184
185
 
185
186
  ## Setting options
186
187
 
@@ -188,12 +189,12 @@ You can control how `labrat` composes a label completely from the command-line,
188
189
 
189
190
  Labrat reads options from the following locations, with the locations listed from lowest to highest priority. In other words, options set in the first-listed location can be overriden by settings in later-listed locations.
190
191
 
191
- 1. From `/etc/xdg/labrat/config.yml`. This is a YAML formatted file in which the long form of the option, without the leading '&#x2013;', is used as a key with the setting as the value.
192
+ 1. From `/etc/xdg/labrat/config.yml`. This is a YAML formatted file in which the long form of the option, without the leading '&ndash;', is used as a key with the setting as the value.
192
193
  2. From `~/.config/labrat/config.yml`. It also uses the YAML format based on the long form of option names.
193
194
  3. Finally, it reads options from the command-line, where, of course, the leading hyphens are mandatory.
194
195
 
195
196
 
196
- <a id="org73003a4"></a>
197
+ <a id="org6e2ad7d"></a>
197
198
 
198
199
  ## Dimensions and other values in options
199
200
 
@@ -210,14 +211,14 @@ Many of the options deal with specifying some sort of distance. Those are design
210
211
  Most other options are strings, which need to be quoted on the command-line if they contain any spaces or other characters special to your shell. In the configuration files, string values need not be quoted.
211
212
 
212
213
 
213
- <a id="orgc698d7b"></a>
214
+ <a id="org0e486f5"></a>
214
215
 
215
216
  ## Page Setup Options
216
217
 
217
- `Labrat` can handle multi-label pages such as Avery-style label sheets. These options deal with the page-level dimensions of the, potentially, multi-label page. By contrast, the dimensions of individual labels are dealt with by the label setup options described in the [next](#orgb0d154a) section.
218
+ `Labrat` can handle multi-label pages such as Avery-style label sheets. These options deal with the page-level dimensions of the, potentially, multi-label page. By contrast, the dimensions of individual labels are dealt with by the label setup options described in the [next](#orgf598b9b) section.
218
219
 
219
220
 
220
- <a id="org673748d"></a>
221
+ <a id="orgdbf03d2"></a>
221
222
 
222
223
  ### Orientation
223
224
 
@@ -225,7 +226,7 @@ Most other options are strings, which need to be quoted on the command-line if t
225
226
  - **`-P`, `--[no-]portrait`:** This is simply a convenience switch meaning `--no-landscape` and is the default.
226
227
 
227
228
 
228
- <a id="orga97a775"></a>
229
+ <a id="org5cf4cb6"></a>
229
230
 
230
231
  ### Page Dimensions
231
232
 
@@ -244,7 +245,7 @@ With that in mind, specifying the page dimensions is just a matter of getting ou
244
245
  - **`--page-margin=DIM`:** Distance from all sides of page (in portrait) to the print area; short for `--top-page-margin`, `--bottom-page-margin`, `--left-page-margin` and `--right-page-margin`
245
246
 
246
247
 
247
- <a id="orge513fa5"></a>
248
+ <a id="org5a2bf0a"></a>
248
249
 
249
250
  ### Page Grid
250
251
 
@@ -256,7 +257,7 @@ By default, `labrat` considers a page of labels to contain only one row and one
256
257
  - **`--column-gap=DIM`:** The distance between columns of labels on a page
257
258
 
258
259
 
259
- <a id="orgb0d154a"></a>
260
+ <a id="orgf598b9b"></a>
260
261
 
261
262
  ## Label Setup Options
262
263
 
@@ -270,7 +271,7 @@ These options determine the layout of individual labels within the page grid rat
270
271
  The remaining space on the page is divided into a grid of identically-sized labels, which determines the size of each label.
271
272
 
272
273
 
273
- <a id="org7405c33"></a>
274
+ <a id="org33fedfd"></a>
274
275
 
275
276
  ### Padding
276
277
 
@@ -285,7 +286,7 @@ Within each label, the following options allow you to set the margins on each si
285
286
  - **`--pad=DIM`:** Short for `--top-pad=DIM`, `--bottom-pad=DIM`, `--left-pad=DIM` and `--right-pad=DIM`
286
287
 
287
288
 
288
- <a id="org2181c47"></a>
289
+ <a id="orgd4ff68f"></a>
289
290
 
290
291
  ### Alignment
291
292
 
@@ -295,7 +296,7 @@ By default the label text is centered horizontally and vertically within the lab
295
296
  - **`--v-align=[top|center|bottom]`:** Vertical alignment of text within the label (default center)
296
297
 
297
298
 
298
- <a id="org34b3ec2"></a>
299
+ <a id="orgd037ada"></a>
299
300
 
300
301
  ### Fonts and styling
301
302
 
@@ -306,7 +307,7 @@ By default the label text is centered horizontally and vertically within the lab
306
307
  - **`--font-style=[normal|bold|italic|bold-italic]`:** Style of font to use for text (default normal)
307
308
 
308
309
 
309
- <a id="org3b0bd36"></a>
310
+ <a id="orgf8d7ac5"></a>
310
311
 
311
312
  ### Position Adjustment
312
313
 
@@ -316,14 +317,14 @@ Despite our best efforts, the vagaries of printer hardware, print drivers, and c
316
317
  - **`-y, --delta-y=DIM`:** Up-down adjustment (positive moves up, negative down) of label text within the label print area.
317
318
 
318
319
 
319
- <a id="org687b5fe"></a>
320
+ <a id="orgf810ded"></a>
320
321
 
321
322
  ## Job Processing Options
322
323
 
323
324
  The following options control the processing of labels by `labrat`.
324
325
 
325
326
 
326
- <a id="org9f88ae2"></a>
327
+ <a id="org6edabda"></a>
327
328
 
328
329
  ### Starting label
329
330
 
@@ -334,7 +335,7 @@ When printing onto a multi-label page, some of the labels may have already been
334
335
  This only affects the placement of the first label on the first page. Any later pages always start on the first label position.
335
336
 
336
337
 
337
- <a id="org038b8d4"></a>
338
+ <a id="org7da27f4"></a>
338
339
 
339
340
  ### New line marker
340
341
 
@@ -343,7 +344,7 @@ You can embed a special text-sequence in the label text to indicate where a line
343
344
  - **`-n`, `--nl-sep=SEPARATOR`:** Specify text to be translated into a line-break (default ' `∼∼` ')
344
345
 
345
346
 
346
- <a id="orgabdfba3"></a>
347
+ <a id="orgd2462ca"></a>
347
348
 
348
349
  ### Label separator
349
350
 
@@ -352,7 +353,7 @@ The only way to print more than one label from the command-line is to indicate w
352
353
  - **`--label-sep=SEPARATOR`:** Specify text that indicates the start of a new label (default '@@')
353
354
 
354
355
 
355
- <a id="org03365b1"></a>
356
+ <a id="org429b3fa"></a>
356
357
 
357
358
  ### Number of copies
358
359
 
@@ -361,7 +362,7 @@ This option causes `labrat` to generate multiple copies of each label with all t
361
362
  - **`-c NUM`, `--copies=NUM`:** Number of copies of each label to generate.
362
363
 
363
364
 
364
- <a id="orgab3df6b"></a>
365
+ <a id="org664db30"></a>
365
366
 
366
367
  ### Input and output files
367
368
 
@@ -429,10 +430,10 @@ This option causes `labrat` to generate multiple copies of each label with all t
429
430
 
430
431
  5. Template exception
431
432
 
432
- Notwithstanding all of the above, if the `-T` (`--template`) option is given (see below at [7.5.8](#org5383ea7)), all label texts from the command-line, an `in-file`, or standard input are ignored and a template is generated.
433
+ Notwithstanding all of the above, if the `-T` (`--template`) option is given (see below at [7.5.9](#orgf5aedaf)), all label texts from the command-line, an `in-file`, or standard input are ignored and a template is generated.
433
434
 
434
435
 
435
- <a id="orgc737bdb"></a>
436
+ <a id="org079e818"></a>
436
437
 
437
438
  ### Printing or viewing
438
439
 
@@ -441,20 +442,20 @@ By default, `labrat` prints the generated output file to the printer named with
441
442
  - **`-V`, `--[no-]view`:** View rather than print
442
443
 
443
444
 
444
- <a id="org5fbf44a"></a>
445
+ <a id="org8834ee6"></a>
445
446
 
446
447
  ### Printing and viewing shell commands
447
448
 
448
449
  By default, `labrat` uses the shell command:
449
450
 
450
451
  ```
451
- lpr -P %p %o
452
+ lpr -P %p %O %o
452
453
  ```
453
454
 
454
- to print, and substitutes '%p' with the printer name and '%o' with the output file name. But you can specify a different print command with the `--print-command` option. The printer name used in the substitution is by default taken from the environment variable `LABRAT_PRINTER` if it is defined, or from the environment variable `PRINTER` if it is defined and `LABRAT_PRINTER` is not defined. If neither is defined, it defaults to the name 'dymo'. But you can set the printer name with the `--printer` option in any event.
455
+ to print, and substitutes '%p' with the printer name, %O with the print options, and '%o' with the output file name. But you can specify a different print command with the `--print-command` option. The printer name used in the substitution is by default taken from the environment variable `LABRAT_PRINTER` if it is defined, or from the environment variable `PRINTER` if it is defined and `LABRAT_PRINTER` is not defined. If neither is defined, it defaults to the name 'dymo'. But you can set the printer name with the `--printer` option in any event.
455
456
 
456
457
  - **`-p`, `--printer=NAME`:** Name of the label printer to print on
457
- - **`-%`, `--print-command=PRINTCMD`:** Command to use for printing with %p for printer name; %o for label file name (the \`%\` is meant to remind you of a piece of a paper beingg fed between two rollers)
458
+ - **`-%`, `--print-command=PRINTCMD`:** Command to use for printing with %p for printer name; %O for the print options; and %o for label file name (the \`%\` is meant to remind you of a piece of a paper beingg fed between two rollers)
458
459
 
459
460
  Likewise, `labrat` uses the shell command
460
461
 
@@ -462,12 +463,64 @@ Likewise, `labrat` uses the shell command
462
463
  qpdfview --unique --instance labrat %o'
463
464
  ```
464
465
 
465
- to launch the previewer when the `--view` or `-V` options are given. It also '%o' with the output file name, but does not recognize '%p' as special. It is very likely that you will want to configure this with the `--view-command` option to your liking.
466
+ to launch the previewer when the `--view` or `-V` options are given. It also substitutes '%o' with the output file name, but does not recognize '%p' as special. It is very likely that you will want to configure this with the `--view-command` option to your liking.
466
467
 
467
468
  - **`-:`, `--view-command=VIEWCMD`:** Command to use for viewing with %o for label file name (the \`:\` is meant to remind you of a pair of eyes looking at the purdy label)
468
469
 
469
470
 
470
- <a id="org5383ea7"></a>
471
+ <a id="orgbd5e973"></a>
472
+
473
+ ### Print Options
474
+
475
+ `labrat` allows you to set printer *options* with the `--print-option` (or `-O`) command-line option. These options are substituted for the `%O` placeholder in the `print-command` as described above. Since the default print-command invokes `lpr`, this is primarily targeted at options for the `lpr` command. You can see what options are available with
476
+
477
+ ```
478
+ lpoptions -p <PRINTER_NAME> -l
479
+ ```
480
+
481
+ For example, my local label printer is a Dymo LabelWriter 400 Turbo and is named `dymo` on my system. Here are the results on my system:
482
+
483
+ ```sh
484
+ lpoptions -p dymo -l
485
+ ```
486
+
487
+ ```
488
+ PageSize/Media Size: w154h64 w72h154 w72h72 w162h90 w54h144 w118h252 w167h188 w79h252 w167h252 w167h288 w154h198 w82h248 w154h64.1 w79h252.1 w102h252 w154h286 w154h198.1 w54h424 w131h221 *w57h248 w54h144.1 w72h72.1 w72h72.2 w162h90.1 30334_2-1_4_in_x_1-1_4_in w73h86 w72h154.1 w118h252.1 w54h203 w54h180 w36h136 w72h108 w65h90 w167h288.1 w168h252 w144h169 w71h144 w144h252 w80h144 w162h504 30383_PC_Postage_3-Part w167h540 30384_PC_Postage_2-Part w167h756 30387_PC_Postage_EPS w167h188.1 w176h292 w167h288.2 w112h126 w79h252.2 w102h252.1 w154h286.1 w154h286.2 w154h198.2 w63h419 w139h221 w36h144 w108h539 w167h539 w154h7680 w154h792 Custom.WIDTHxHEIGHT
489
+ Resolution/Output Resolution: *300dpi
490
+ DymoHalftoning/Halftoning: Default *ErrorDiffusion NLL
491
+ DymoPrintDensity/Print Density: Light Medium *Normal Dark
492
+ DymoPrintQuality/Print Quality: *Text Graphics
493
+ InputSlot/Media Source: *Auto Left Right
494
+ ```
495
+
496
+ NOTE: the output from lpoptions shows options as <OptionName>/<HumanDescription>, so you should only use the part *before* the `/`. Thus, the option names for my printer are `PageSize`, `Resolution`, `InputSlot`, and `cupsDarkness`. Each of those is followed by their possible values with the current default value marked with an `*` asterisk.
497
+
498
+ You can specify as many print options as needed and they will each be passed as "-o <OPTIONTEXT>" to the `print-command` in lieu of the `%O` placeholder. So, I could use
499
+
500
+ ```sh
501
+ labrat --print-option=InputSlot=Roll2 -O Resolution=136dpi Roll2 LowRes Sample Label
502
+ ```
503
+
504
+ These options are ignored in the view-command.
505
+
506
+ Also, like all options, these can be set in the `labeldb.yml` file to define a virtual label by using the YAML array form:
507
+
508
+ ```
509
+ fflr:
510
+ label: duraready1034D
511
+ font-style: bold
512
+ font-size: 12pt
513
+ delta-x: -3mm
514
+ delta-y: 0.5mm
515
+ print-options:
516
+ - InputSlot=Roll2
517
+ - Resolution=136dpi
518
+ ```
519
+
520
+ NOTE: the command line option is singular, `--print-option` but `labrat` allows the use of singular or plural in the `labeldb.yml` file as shown in the above example.
521
+
522
+
523
+ <a id="orgf5aedaf"></a>
471
524
 
472
525
  ### Aids to testing label layouts
473
526
 
@@ -492,14 +545,14 @@ to launch the previewer when the `--view` or `-V` options are given. It also '%o
492
545
  - **`-v`, `--[no-]verbose`:** Run verbosely, that is, print out lots of information about what `labrat` is doing as it processes the job.
493
546
 
494
547
 
495
- <a id="org43755ad"></a>
548
+ <a id="org3b44ec8"></a>
496
549
 
497
550
  ## The Label Database and the label option
498
551
 
499
552
  One of the nice things about `labrat` is that it comes with a database of pre-defined label configurations for many standard labels, especially Avery labels since they were good enough to publish PDF templates for all their products at <https://www.avery.com/templates>.
500
553
 
501
554
 
502
- <a id="org47479ac"></a>
555
+ <a id="org1e6d591"></a>
503
556
 
504
557
  ### Listing labels
505
558
 
@@ -512,7 +565,7 @@ $ labrat --list-labels
512
565
  Any users who create useful label definitions can propose them for inclusion with `labrat's` distributed label database by filing a pull request at this git repository.
513
566
 
514
567
 
515
- <a id="orga53002b"></a>
568
+ <a id="org3efa50e"></a>
516
569
 
517
570
  ### System label database
518
571
 
@@ -536,7 +589,7 @@ avery8987:
536
589
  Note that it restricts itself to page-level settings. It would be inappropriate to, for example, include something like `font-style` in a system-wide label definition, though such things can be useful in a user's private label configuration.
537
590
 
538
591
 
539
- <a id="org1ee27db"></a>
592
+ <a id="org20918c3"></a>
540
593
 
541
594
  ### Trying out a label definition
542
595
 
@@ -553,7 +606,7 @@ $ labrat -V -c30 --label=avery8987 'Four score and seven years ago ~~ Our father
553
606
  ```
554
607
 
555
608
 
556
- <a id="org3e9c72c"></a>
609
+ <a id="orgd676030"></a>
557
610
 
558
611
  ### Nesting label definitions
559
612
 
@@ -567,7 +620,7 @@ avery8986:
567
620
  In other words, it defines the `avery8986` label with a nested `--label` option that simply incorporates the `avery8987` entry settings.
568
621
 
569
622
 
570
- <a id="org9db78c7"></a>
623
+ <a id="orgde87b9d"></a>
571
624
 
572
625
  ### Label database entries as configuration sets
573
626
 
@@ -613,7 +666,7 @@ $ labrat -V -c14 --label=badge 'Daniel E. Doherty ~~ (Amateur Programmer)'
613
666
  ```
614
667
 
615
668
 
616
- <a id="orgba4a7ec"></a>
669
+ <a id="org1e209d8"></a>
617
670
 
618
671
  ### A Caution about option order
619
672
 
@@ -632,7 +685,7 @@ $ labrat --label=ff --font-style=italic 'Four score and seven years ago ~~ Our f
632
685
  ```
633
686
 
634
687
 
635
- <a id="org480b590"></a>
688
+ <a id="org2018651"></a>
636
689
 
637
690
  # Development
638
691
 
@@ -641,7 +694,7 @@ After checking out the repo, run \`bin/setup\` to install dependencies. Then, ru
641
694
  To install this gem onto your local machine, run \`bundle exec rake install\`.
642
695
 
643
696
 
644
- <a id="orgf644906"></a>
697
+ <a id="org15803f7"></a>
645
698
 
646
699
  # Contributing
647
700
 
data/README.org CHANGED
@@ -67,6 +67,7 @@ Buy your copy today while supplies last!
67
67
  - [[#template-exception][Template exception]]
68
68
  - [[#printing-or-viewing][Printing or viewing]]
69
69
  - [[#printing-and-viewing-shell-commands][Printing and viewing shell commands]]
70
+ - [[#print-options][Print Options]]
70
71
  - [[#aids-to-testing-label-layouts][Aids to testing label layouts]]
71
72
  - [[#page-grid-1][Page Grid]]
72
73
  - [[#page-template][Page Template]]
@@ -140,8 +141,8 @@ It will also install an annotated sample user config file in
140
141
 
141
142
  If you invoke =labrat-install= multiple times, it will refuse to overwrite any
142
143
  existing config or database files that you may have already installed. If you
143
- want to re-install them you have to remove the existing files or move them out
144
- of the way.
144
+ want to re-install them you first have to remove the existing files or move
145
+ them out of the way.
145
146
 
146
147
  * Editor Integration
147
148
  ** Emacs
@@ -154,7 +155,7 @@ C-l C-v~ to =labrat-view=, and I can type a label in any buffer and get it
154
155
  generated with very little ceremony.
155
156
 
156
157
  ** Vim
157
- There is also a vim plugin that you can copy to you =~.vim/plugins/labrat.vim=
158
+ There is also a vim plugin that you can copy to you =~/.vim/plugins/labrat.vim=
158
159
  directory to invoke ~labrat~ from within ~vim~. Suggested keybindings are
159
160
  included for copying to =~/.vim/after/plugin/labrat.vim= that bind
160
161
  =<leader>lp= and =<leader>lv= to invoke ~labrat~ in normal and visual modes.
@@ -543,35 +544,97 @@ command from ~--view-command~ to view the generated PDF file instead.
543
544
  *** Printing and viewing shell commands
544
545
  By default, =labrat= uses the shell command:
545
546
  #+begin_example
546
- lpr -P %p %o
547
+ lpr -P %p %O %o
547
548
  #+end_example
548
- to print, and substitutes '%p' with the printer name and '%o' with the output
549
- file name. But you can specify a different print command with the
550
- ~--print-command~ option. The printer name used in the substitution is by
551
- default taken from the environment variable =LABRAT_PRINTER= if it is defined,
552
- or from the environment variable =PRINTER= if it is defined and
553
- =LABRAT_PRINTER= is not defined. If neither is defined, it defaults to the
554
- name 'dymo'. But you can set the printer name with the ~--printer~ option in
555
- any event.
549
+ to print, and substitutes '%p' with the printer name, %O with the print
550
+ options, and '%o' with the output file name. But you can specify a different
551
+ print command with the ~--print-command~ option. The printer name used in the
552
+ substitution is by default taken from the environment variable
553
+ =LABRAT_PRINTER= if it is defined, or from the environment variable =PRINTER=
554
+ if it is defined and =LABRAT_PRINTER= is not defined. If neither is defined,
555
+ it defaults to the name 'dymo'. But you can set the printer name with the
556
+ ~--printer~ option in any event.
556
557
 
557
558
  - ~-p~, ~--printer=NAME~ :: Name of the label printer to print on
558
559
  - ~-%~, ~--print-command=PRINTCMD~ :: Command to use for printing with %p for
559
- printer name; %o for label file name (the `%` is meant to remind you of a
560
- piece of a paper beingg fed between two rollers)
560
+ printer name; %O for the print options; and %o for label file name (the `%`
561
+ is meant to remind you of a piece of a paper beingg fed between two rollers)
561
562
 
562
563
  Likewise, =labrat= uses the shell command
563
564
  #+begin_example
564
565
  qpdfview --unique --instance labrat %o'
565
566
  #+end_example
566
567
  to launch the previewer when the ~--view~ or ~-V~ options are given. It also
567
- '%o' with the output file name, but does not recognize '%p' as special. It is
568
- very likely that you will want to configure this with the ~--view-command~
569
- option to your liking.
568
+ substitutes '%o' with the output file name, but does not recognize '%p' as
569
+ special. It is very likely that you will want to configure this with the
570
+ ~--view-command~ option to your liking.
570
571
 
571
572
  - ~-:~, ~--view-command=VIEWCMD~ :: Command to use for viewing with %o for
572
573
  label file name (the `:` is meant to remind you of a pair of eyes looking at
573
574
  the purdy label)
574
575
 
576
+ *** Print Options
577
+ =labrat= allows you to set printer /options/ with the ~--print-option~ (or
578
+ =-O=) command-line option. These options are substituted for the =%O=
579
+ placeholder in the =print-command= as described above. Since the default
580
+ print-command invokes =lpr=, this is primarily targeted at options for the
581
+ =lpr= command. You can see what options are available with
582
+ #+begin_example
583
+ lpoptions -p <PRINTER_NAME> -l
584
+ #+end_example
585
+
586
+ For example, my local label printer is a Dymo LabelWriter 400 Turbo and is
587
+ named =dymo= on my system. Here are the results on my system:
588
+
589
+ #+begin_src sh :eval yes :results output raw :wrap example
590
+ lpoptions -p dymo -l
591
+ #+end_src
592
+
593
+ #+RESULTS:
594
+ #+begin_example
595
+ PageSize/Media Size: w154h64 w72h154 w72h72 w162h90 w54h144 w118h252 w167h188 w79h252 w167h252 w167h288 w154h198 w82h248 w154h64.1 w79h252.1 w102h252 w154h286 w154h198.1 w54h424 w131h221 *w57h248 w54h144.1 w72h72.1 w72h72.2 w162h90.1 30334_2-1_4_in_x_1-1_4_in w73h86 w72h154.1 w118h252.1 w54h203 w54h180 w36h136 w72h108 w65h90 w167h288.1 w168h252 w144h169 w71h144 w144h252 w80h144 w162h504 30383_PC_Postage_3-Part w167h540 30384_PC_Postage_2-Part w167h756 30387_PC_Postage_EPS w167h188.1 w176h292 w167h288.2 w112h126 w79h252.2 w102h252.1 w154h286.1 w154h286.2 w154h198.2 w63h419 w139h221 w36h144 w108h539 w167h539 w154h7680 w154h792 Custom.WIDTHxHEIGHT
596
+ Resolution/Output Resolution: *300dpi
597
+ DymoHalftoning/Halftoning: Default *ErrorDiffusion NLL
598
+ DymoPrintDensity/Print Density: Light Medium *Normal Dark
599
+ DymoPrintQuality/Print Quality: *Text Graphics
600
+ InputSlot/Media Source: *Auto Left Right
601
+ #+end_example
602
+
603
+ NOTE: the output from lpoptions shows options as
604
+ <OptionName>/<HumanDescription>, so you should only use the part /before/ the
605
+ ~/~. Thus, the option names for my printer are =PageSize=, =Resolution=,
606
+ =InputSlot=, and =cupsDarkness=. Each of those is followed by their possible
607
+ values with the current default value marked with an ~*~ asterisk.
608
+
609
+ You can specify as many print options as needed and they will each be passed
610
+ as "-o <OPTIONTEXT>" to the =print-command= in lieu of the =%O= placeholder.
611
+ So, I could use
612
+
613
+ #+begin_src sh
614
+ labrat --print-option=InputSlot=Roll2 -O Resolution=136dpi Roll2 LowRes Sample Label
615
+ #+end_src
616
+
617
+ These options are ignored in the view-command.
618
+
619
+ Also, like all options, these can be set in the =labeldb.yml= file to define a
620
+ virtual label by using the YAML array form:
621
+
622
+ #+begin_example
623
+ fflr:
624
+ label: duraready1034D
625
+ font-style: bold
626
+ font-size: 12pt
627
+ delta-x: -3mm
628
+ delta-y: 0.5mm
629
+ print-options:
630
+ - InputSlot=Roll2
631
+ - Resolution=136dpi
632
+ #+end_example
633
+
634
+ NOTE: the command line option is singular, =--print-option= but =labrat=
635
+ allows the use of singular or plural in the =labeldb.yml= file as shown in the
636
+ above example.
637
+
575
638
  *** Aids to testing label layouts
576
639
 
577
640
  **** Page Grid
data/labrat.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["ded-labrat@ddoherty.net"]
10
10
 
11
11
  spec.summary = "Command-line and Emacs label print software."
12
+ spec.license = "MIT"
12
13
  spec.description = <<~DESC
13
14
 
14
15
  Labrat is a linux command-line program for quickly printing labels. Labrat uses
@@ -27,7 +28,7 @@ Gem::Specification.new do |spec|
27
28
  DESC
28
29
 
29
30
  spec.homepage = "http://github.com/ddoherty03/labrat"
30
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
31
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.2")
31
32
 
32
33
  spec.metadata["homepage_uri"] = spec.homepage
33
34
  spec.metadata["source_code_uri"] = "http://github.com/ddoherty03/labrat"
@@ -45,6 +46,7 @@ Gem::Specification.new do |spec|
45
46
  spec.rdoc_options += ['-D', '--ri', '--exclude', '^lib/lisp.*', '--exclude', '^lib/vim.*']
46
47
 
47
48
  spec.add_dependency "activesupport"
49
+ spec.add_dependency "bigdecimal", "~> 3.1"
48
50
  spec.add_dependency "fat_config", '>=0.4.2'
49
51
  spec.add_dependency "matrix"
50
52
  spec.add_dependency "prawn", "<=2.5"
@@ -116,8 +116,11 @@
116
116
  # and allows a unique instance to be dedicated to labrat with the --unique and
117
117
  # --instance flags.
118
118
  #
119
- # print-command: lpr -P %p %o
119
+ # print-command: lpr -P %p %O %o
120
120
  # view-command: qpdfview --unique --instance labrat %o
121
+ # print-option:
122
+ # - InputSlot=Right
123
+ # - Resolution=150
121
124
 
122
125
  # The following correspond to the -V, -T, and -v flags respectively.
123
126
  #
@@ -528,7 +528,7 @@ module Labrat
528
528
  parser.on(
529
529
  "-%PRINTCMD",
530
530
  "--print-command=PRINTCMD",
531
- "Command to use for printing with %p for printer name; %o for label file name",
531
+ "Command to use for printing with %p for printer name; %o for label file name; %O print options",
532
532
  ) do |cmd|
533
533
  options.print_command = cmd.strip
534
534
  warn " ::print-command <- '#{cmd}'::" if options.verbose
@@ -542,6 +542,15 @@ module Labrat
542
542
  options.view_command = cmd.strip
543
543
  warn " ::view-command <- '#{cmd}'::" if options.verbose
544
544
  end
545
+ # NB: Get possible options from `lpoptions -l -p <printername>`
546
+ parser.on(
547
+ "-O OPTIONTEXT",
548
+ "--print-option=OPTIONTEXT",
549
+ "Options to add to print-command a la `lpoptions -l -p <printername>`",
550
+ ) do |txt|
551
+ options.print_options << txt
552
+ warn " ::print-option <- '#{txt}'::" if options.verbose
553
+ end
545
554
  end
546
555
 
547
556
  # Whether the label ought to be printed in landscape orientation, that is,
data/lib/labrat/hash.rb CHANGED
@@ -7,12 +7,17 @@ class Hash
7
7
  options = []
8
8
  each_pair do |k, v|
9
9
  key = k.to_s.tr('_', '-')
10
- options <<
11
- if [TrueClass, FalseClass].include?(v.class)
12
- v ? "--#{key}" : "--no-#{key}"
13
- else
14
- "--#{key}=#{v}"
15
- end
10
+ key = 'print-option' if key == 'print-options'
11
+ if v.is_a?(Array)
12
+ v.each { |value| options << "--#{key}=#{value}" }
13
+ else
14
+ options <<
15
+ if [TrueClass, FalseClass].include?(v.class)
16
+ v ? "--#{key}" : "--no-#{key}"
17
+ else
18
+ "--#{key}=#{v}"
19
+ end
20
+ end
16
21
  end
17
22
  options
18
23
  end
data/lib/labrat/label.rb CHANGED
@@ -124,11 +124,16 @@ module Labrat
124
124
  end
125
125
 
126
126
  def print
127
- cmd = ops.print_command.gsub('%p', ops.printer).gsub('%o', ops.out_file)
128
- if ops.verbose
129
- warn "Printing with:"
130
- warn " #{cmd} &"
127
+ print_options =
128
+ Shellwords.join(ops.print_options.flat_map { |option| ['-o', option] })
129
+ cmd = ops.print_command.gsub(/%[pOo]/) do |placeholder|
130
+ case placeholder
131
+ when '%p' then Shellwords.escape(ops.printer)
132
+ when '%o' then Shellwords.escape(ops.out_file)
133
+ when '%O' then print_options
134
+ end
131
135
  end
136
+ warn "Printing with:\n #{cmd} &" if ops.verbose
132
137
  system("#{cmd} &")
133
138
  end
134
139
 
@@ -40,6 +40,7 @@ module Labrat
40
40
  :out_file,
41
41
  :print_command,
42
42
  :view_command,
43
+ :print_options,
43
44
  :view,
44
45
  :template,
45
46
  :verbose,
@@ -82,8 +83,9 @@ module Labrat
82
83
  # Output attributes
83
84
  self.printer = init[:printer] || ENV['LABRAT_PRINTER'] || ENV['PRINTER'] || 'dymo'
84
85
  self.out_file = init[:out_file] || self.class.default_out_file
85
- self.print_command = init[:print_command] || 'lpr -P %p %o'
86
+ self.print_command = init[:print_command] || 'lpr -P %p %O %o'
86
87
  self.view_command = init[:view_command] || 'qpdfview --unique --instance labrat %o'
88
+ self.print_options = init[:print_options] || []
87
89
  self.view = init.fetch(:view, false)
88
90
  self.template = init.fetch(:landscape, false)
89
91
  self.grid = init.fetch(:gid, false)
@@ -121,7 +123,7 @@ module Labrat
121
123
  dir = File.expand_path(File.join(base, "labrat"))
122
124
  FileUtils.mkdir_p(dir)
123
125
  stamp = Time.now.strftime("%Y-%m-%dT%H:%M:%S.%3N")
124
- File.join(dir, "#{stamp}-#{$$}.pdf")
126
+ File.join(dir, "#{stamp}-#{$PID}.pdf")
125
127
  end
126
128
 
127
129
  # Return any string in msg, e.g., the usage help or error.
@@ -200,6 +202,7 @@ module Labrat
200
202
  out_file: out_file,
201
203
  print_command: print_command,
202
204
  view_command: view_command,
205
+ print_options: print_options,
203
206
  view: view,
204
207
  template: template,
205
208
  verbose: verbose,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Labrat
4
- VERSION = "1.6.0"
4
+ VERSION = "1.7.0"
5
5
  end
data/lib/labrat.rb CHANGED
@@ -1,11 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Active Support otherwise activates the newest BigDecimal before Prawn can
4
+ # enforce ttfunk's more restrictive dependency.
5
+ gem 'bigdecimal', '~> 3.1'
6
+
3
7
  require 'active_support'
4
8
  require 'active_support/core_ext'
5
9
  require 'fat_core/enumerable'
6
10
  require 'fat_config'
7
11
  require 'prawn'
8
12
  require 'prawn/measurement_extensions'
13
+ require 'shellwords'
9
14
  require 'optparse'
10
15
  require 'yaml'
11
16
  require 'pp'
data/lib/lisp/labrat.el CHANGED
@@ -1,3 +1,5 @@
1
+ ;; -*- lexical-binding: t; -*-
2
+
1
3
  ;;;; labrat -- Print labels using labrat from within a buffer.
2
4
 
3
5
  ;;; Commentary:
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: labrat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-09-21 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: bigdecimal
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.1'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: fat_config
28
42
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +104,6 @@ extra_rdoc_files: []
90
104
  files:
91
105
  - ".envrc"
92
106
  - ".github/workflows/main.yml"
93
- - ".github/workflows/ruby.yml"
94
107
  - ".gitignore"
95
108
  - ".rspec"
96
109
  - ".rubocop.yml"
@@ -101,6 +114,7 @@ files:
101
114
  - CHANGELOG.org
102
115
  - Gemfile
103
116
  - Gemfile.lock
117
+ - LICENSE
104
118
  - Notes.org
105
119
  - README.md
106
120
  - README.org
@@ -134,7 +148,8 @@ files:
134
148
  - texlabels/sample.pdf
135
149
  - texlabels/sample.tex
136
150
  homepage: http://github.com/ddoherty03/labrat
137
- licenses: []
151
+ licenses:
152
+ - MIT
138
153
  metadata:
139
154
  homepage_uri: http://github.com/ddoherty03/labrat
140
155
  source_code_uri: http://github.com/ddoherty03/labrat
@@ -153,14 +168,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
168
  requirements:
154
169
  - - ">="
155
170
  - !ruby/object:Gem::Version
156
- version: 2.4.0
171
+ version: '3.2'
157
172
  required_rubygems_version: !ruby/object:Gem::Requirement
158
173
  requirements:
159
174
  - - ">="
160
175
  - !ruby/object:Gem::Version
161
176
  version: '0'
162
177
  requirements: []
163
- rubygems_version: 4.0.0
178
+ rubygems_version: 3.6.2
164
179
  specification_version: 4
165
180
  summary: Command-line and Emacs label print software.
166
181
  test_files: []
@@ -1,38 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby Versions
9
-
10
- on:
11
- push:
12
- branches: [ "master" ]
13
- pull_request:
14
- branches: [ "master" ]
15
-
16
- permissions:
17
- contents: read
18
-
19
- jobs:
20
- test:
21
-
22
- runs-on: ubuntu-latest
23
- strategy:
24
- matrix:
25
- ruby-version: ['3.2', '3.3', '3.4']
26
-
27
- steps:
28
- - uses: actions/checkout@v4
29
- - name: Set up Ruby
30
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
- # uses: ruby/setup-ruby@v1
33
- uses: ruby/setup-ruby@v1 # v1.146.0
34
- with:
35
- ruby-version: ${{ matrix.ruby-version }}
36
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
- - name: Run tests
38
- run: bundle exec rake