termline 1.1.1 → 1.1.3

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.
data/readme.md CHANGED
@@ -1,55 +1,293 @@
1
- <div align="center" class="documentation-header">
2
- <img width="100" alt="LesliTesting logo" src="./docs/images/termline-logo.svg" />
3
- <h3 align="center">Human-friendly terminal logs for the Lesli Platform</h3>
1
+ <div align="center">
2
+ <h1 align="center">
3
+ <img width="100" alt="Termline" src="./docs/images/termline-logo.svg" />
4
+ </h1>
5
+ <h3 align="center">Human-friendly terminal output for Ruby applications.</h3>
4
6
  </div>
5
7
 
6
8
  <br />
7
- <hr/>
9
+
10
+ <div align="center">
11
+ <a target="_blank" href="https://github.com/LesliTech/Termline/actions/workflows/master.yml">
12
+ <img alt="Termline test status" src="https://img.shields.io/github/actions/workflow/status/LesliTech/Termline/master.yml?branch=master&style=for-the-badge&logo=github&label=tests">
13
+ </a>
14
+ <a target="_blank" href="https://rubygems.org/gems/termline">
15
+ <img alt="Gem Version" src="https://img.shields.io/gem/v/termline?style=for-the-badge&logo=ruby">
16
+ </a>
17
+ <a target="_blank" href="https://codecov.io/github/LesliTech/Termline">
18
+ <img alt="Codecov" src="https://img.shields.io/codecov/c/github/LesliTech/Termline?style=for-the-badge&logo=codecov">
19
+ </a>
20
+ <a target="_blank" href="https://sonarcloud.io/project/overview?id=LesliTech_Termline">
21
+ <img alt="Sonar Quality Gate" src="https://img.shields.io/sonar/quality_gate/LesliTech_Termline?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud&label=Quality">
22
+ </a>
23
+ </div>
24
+
25
+ <br />
26
+
27
+ <div align="center">
28
+ <img
29
+ style="width:100%;max-width:800px;border-radius:6px;"
30
+ alt="Termline formatted terminal output"
31
+ src="./docs/images/screenshot.png" />
32
+ </div>
33
+
34
+ <br />
35
+
36
+ ---
37
+
38
+ <br />
39
+
40
+ ## Introduction
41
+
42
+ Termline provides human-friendly terminal output for applications and development tools built with the [Lesli Framework](https://github.com/LesliTech/Lesli).
43
+
44
+ It exposes a small Ruby API for semantic messages, colors, icons, structured metadata, lists, tables, and separators. Termline has no application-framework dependency, so it can also be used by standalone Ruby applications, scripts, Rake tasks, and command-line tools.
45
+
8
46
  <br />
9
47
 
48
+ ## Why Termline?
10
49
 
11
- ### Quick start
50
+ Termline provides:
51
+
52
+ - Consistent terminal output across the Lesli ecosystem
53
+ - Semantic info, success, warning, and danger messages
54
+ - Colored icons, labels, and timestamps
55
+ - Structured key-value metadata
56
+ - Ordered and unordered lists
57
+ - Terminal-aware tables with alignment and truncation
58
+ - Reusable titles, detail blocks, spacing, and adaptive separators
59
+ - A lightweight implementation with no runtime dependencies
60
+
61
+ <br />
62
+
63
+ ## Quick Start
64
+
65
+ ### Requirements
66
+
67
+ - Ruby 2.7.2 or newer
68
+
69
+ Termline is framework-independent and does not require Rails.
70
+
71
+ ### Installation
72
+
73
+ Add Termline to the application:
12
74
 
13
75
  ```shell
14
- # Add LesliAdmin engine gem
15
76
  bundle add termline
16
77
  ```
17
78
 
18
- ### Usage
79
+ Require the gem when Bundler does not load it automatically:
80
+
81
+ ```ruby
82
+ require "termline"
83
+ ```
84
+
85
+ <br />
86
+
87
+ ## Usage
88
+
89
+ ### Messages
90
+
19
91
  ```ruby
92
+ require "termline"
93
+
20
94
  Termline.msg "Hello world"
21
95
  Termline.info "Server started"
22
96
  Termline.success "All tests passed"
23
97
  Termline.warning "Low disk space"
24
98
  Termline.danger "Something failed"
99
+ ```
25
100
 
26
- Termline.br
101
+ Every semantic helper accepts multiple messages and prints each one on its own line:
102
+
103
+ ```ruby
104
+ Termline.info "Loading configuration", "Connecting to database"
105
+ ```
106
+
107
+ Attach structured metadata with keyword arguments:
108
+
109
+ ```ruby
110
+ Termline.success "Compiled application.tailwind.css", size: "1.4 KB"
111
+ Termline.info "Connected", adapter: "postgres", duration: "12ms"
112
+ ```
113
+
114
+ Metadata is rendered in a compact, readable form such as `adapter=postgres duration=12ms`.
115
+
116
+ Override the default tag, icon, or timestamp when the output needs a different presentation:
117
+
118
+ ```ruby
119
+ Termline.info "User authenticated", tag: "AUTH:", icon: :star
120
+ Termline.success "Cache warmed", time: false
121
+ ```
122
+
123
+ Timestamp defaults can also be configured once for the application:
124
+
125
+ ```ruby
126
+ Termline.configure do |config|
127
+ config.timestamps = false
128
+ config.timestamp_format = "%H:%M:%S"
129
+ end
130
+ ```
131
+
132
+ ### Lists and tables
133
+
134
+ ```ruby
135
+ Termline.list("Rails", "Lesli", "Tailwind")
136
+ Termline.list("Database", "Cache", icon: :success, color: :green)
137
+ Termline.ordered_list("Install", "Configure", "Run", start: 1)
27
138
 
28
139
  Termline.table([
29
140
  { name: "Luis", role: "Admin", status: "Active" },
30
141
  { name: "Ana", role: "Developer", status: "Pending" }
31
- ])
142
+ ], align: { name: :left, status: :center })
32
143
  ```
33
144
 
34
- **Result:**
145
+ Tables fit the available terminal width, truncate long values with `…`, and right-align numeric columns automatically.
146
+
147
+ ### Titles and details
35
148
 
36
- <img alt="LesliTesting logo" src="./docs/images/screenshot.png" />
149
+ ```ruby
150
+ Termline.title "Deployment"
151
+ Termline.details environment: "production", version: "1.4.0"
152
+ Termline.details({ status: "ready", workers: 4 }, icons: { status: :success, workers: :info })
153
+ ```
37
154
 
155
+ ### Spacing and separators
38
156
 
39
- ### Documentation
40
- * [website](https://www.lesli.dev/)
41
- * [documentation](https://www.lesli.dev/gems/termline/)
157
+ ```ruby
158
+ Termline.br
159
+ Termline.br(2)
160
+ Termline.line
161
+ Termline.line(character: "=")
162
+ ```
42
163
 
164
+ Without arguments, `line` adapts to the current terminal width.
43
165
 
44
- ### Connect with Lesli
166
+ ### Public API
45
167
 
46
- * [X: @LesliTech](https://x.com/LesliTech)
47
- * [Email: hello@lesli.tech](hello@lesli.tech)
48
- * [Website: https://www.lesli.tech](https://www.lesli.tech)
168
+ | Helper | Purpose |
169
+ | --- | --- |
170
+ | `Termline.m` | Print one or more unformatted values |
171
+ | `Termline.msg` | Print neutral messages with optional metadata |
172
+ | `Termline.info` | Print informational messages |
173
+ | `Termline.success` | Print successful outcomes |
174
+ | `Termline.warning` | Print warnings |
175
+ | `Termline.danger` | Print errors or failed outcomes |
176
+ | `Termline.alert` | Print a high-visibility alert |
177
+ | `Termline.deprecation` | Print a deprecation warning |
178
+ | `Termline.list` | Print an unordered styled list |
179
+ | `Termline.ordered_list` | Print a numbered list |
180
+ | `Termline.table` | Print width-aware arrays, hashes, or Active Record relations as a table |
181
+ | `Termline.title` | Print a terminal-width section title |
182
+ | `Termline.details` | Print an aligned block of labeled details |
183
+ | `Termline.br` | Print blank lines |
184
+ | `Termline.line` | Print a visual separator |
185
+ | `Termline.color` | Print a terminal-width background color bar when ANSI is enabled |
186
+ | `Termline.configure` | Configure output, ANSI mode, width, and timestamp defaults |
49
187
 
188
+ Message, list, table, and spacing helpers write to the configured output, which defaults to `$stdout`. See the focused guides for all supported options and lower-level builders:
189
+
190
+ - [Installation](https://www.lesli.dev/gems/termline/about/installation)
191
+ - [Messages](https://www.lesli.dev/gems/termline/messages)
192
+ - [Lists](https://www.lesli.dev/gems/termline/lists)
193
+ - [Tables](https://www.lesli.dev/gems/termline/tables)
194
+ - [Details](https://www.lesli.dev/gems/termline/details)
195
+ - [Titles](https://www.lesli.dev/gems/termline/text)
196
+ - [Separators and spacing](https://www.lesli.dev/gems/termline/separator)
197
+
198
+ ### Output configuration
199
+
200
+ Termline writes to `$stdout` and enables ANSI styles automatically for interactive terminals. Redirect the output or override ANSI rendering when needed:
201
+
202
+ ```ruby
203
+ require "stringio"
204
+
205
+ buffer = StringIO.new
206
+ Termline.output = buffer
207
+ Termline.ansi = false
208
+
209
+ Termline.success "Saved", time: false
210
+ buffer.string # => "✔ SUCCESS: Saved\n"
211
+ ```
212
+
213
+ The supported ANSI modes are `:auto`, `true`, and `false`. Automatic mode disables escape sequences when the output is not a TTY, when `TERM=dumb`, or when the `NO_COLOR` environment variable is present.
214
+
215
+ The terminal width is detected when content is rendered and falls back to 80 columns. It can be overridden explicitly:
216
+
217
+ ```ruby
218
+ Termline.width = 100
219
+ ```
220
+
221
+ Message timestamps are enabled by default. Use `Termline.timestamps = false` to disable them globally, and `time: true` or `time: false` to override the setting for one message.
222
+
223
+ <br />
224
+
225
+ ## Development
226
+
227
+ Clone the repository and install its dependencies:
228
+
229
+ ```shell
230
+ git clone https://github.com/LesliTech/Termline.git
231
+ cd Termline
232
+ bundle install
233
+ ```
234
+
235
+ To use local source from a Lesli development workspace, reference it from the host application's `Gemfile`:
236
+
237
+ ```ruby
238
+ gem "termline", path: "gems/Termline"
239
+ ```
240
+
241
+ ### Tests
242
+
243
+ Run the default test task from the Termline directory:
244
+
245
+ ```shell
246
+ bundle exec rake
247
+ ```
248
+
249
+ The suite uses LesliTesting for the shared Lesli reporter and coverage configuration. Coverage is opt-in:
250
+
251
+ ```shell
252
+ COVERAGE=true bundle exec rake
253
+ ```
254
+
255
+ Use `QUIET=true` to suppress the line printed for every individual test:
256
+
257
+ ```shell
258
+ QUIET=true COVERAGE=true bundle exec rake
259
+ ```
260
+
261
+ Run the executable examples to preview the available output styles:
262
+
263
+ ```shell
264
+ bundle exec ruby test/demo_termline.rb
265
+ ```
266
+
267
+ <br />
268
+
269
+ ## Documentation
270
+
271
+ - [Lesli website](https://www.lesli.dev/)
272
+ - [Termline documentation](https://www.lesli.dev/gems/termline/)
273
+ - [Testing guide](https://www.lesli.dev/gems/termline/about/testing)
274
+ - [Roadmap and P3 ToDo](./todo.md)
275
+ - [Releases and changelog](https://github.com/LesliTech/Termline/releases)
276
+ - [Issue tracker](https://github.com/LesliTech/Termline/issues)
277
+ - [Source code](https://github.com/LesliTech/Termline)
278
+
279
+ <br />
280
+
281
+ ## Community
282
+
283
+ - [X: @LesliTech](https://x.com/LesliTech)
284
+ - [hello@lesli.tech](mailto:hello@lesli.tech)
285
+ - [https://www.lesli.tech](https://www.lesli.tech)
286
+
287
+ <br />
288
+
289
+ ## License
50
290
 
51
- ### License
52
- -------
53
291
  Copyright (c) 2026, Lesli Technologies, S. A.
54
292
 
55
293
  This program is free software: you can redistribute it and/or modify
@@ -63,19 +301,16 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63
301
  GNU General Public License for more details.
64
302
 
65
303
  You should have received a copy of the GNU General Public License
66
- along with this program. If not, see http://www.gnu.org/licenses/.
304
+ along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
67
305
 
68
- <br />
69
- <hr />
70
- <br />
71
- <br />
306
+ The complete license text is available in the [license file](./license.txt).
72
307
 
73
- <div align="center" class="has-text-centered">
74
- <img width="200" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-logo.svg" />
75
- <h3 align="center" class="mt-0">
76
- The Open-Source SaaS Development Framework for Ruby on Rails.
77
- </h3>
78
- </div>
308
+ ---
79
309
 
80
310
  <br />
81
311
  <br />
312
+
313
+ <div align="center">
314
+ <img width="80" alt="Lesli icon" src="https://cdn.lesli.tech/lesli/brand/app-icon.svg" />
315
+ <h3 align="center">The Open-Source SaaS Development Framework for Ruby on Rails.</h3>
316
+ </div>
data/todo.md ADDED
@@ -0,0 +1,52 @@
1
+ # Termline ToDo
2
+
3
+ ## P3 · Advanced terminal components
4
+
5
+ P3 will extend Termline with richer terminal interfaces while preserving its current lightweight architecture: direct string builders, no markup parser, no component tree, and no runtime dependencies.
6
+
7
+ ### Foundation
8
+
9
+ - [ ] Add a shared visible-width utility that ignores ANSI escape sequences.
10
+ - [ ] Handle Unicode and wide characters correctly when padding, aligning, and truncating content.
11
+ - [ ] Reuse the width utility in tables, titles, separators, and future components.
12
+ - [ ] Define consistent behavior for terminals that are too narrow to render a component.
13
+
14
+ ### Components
15
+
16
+ - [ ] Add a `panel` component for bordered text, optional titles, padding, and semantic colors.
17
+ - [ ] Add a progress bar with configurable width, total, current value, label, and percentage.
18
+ - [ ] Add a spinner or status indicator for long-running tasks.
19
+ - [ ] Provide static builders for every component so output can be composed and tested without printing.
20
+ - [ ] Make dynamic components update in place only when the output is an interactive TTY.
21
+ - [ ] Provide readable, non-animated output when ANSI is disabled or output is redirected.
22
+
23
+ ### API and configuration
24
+
25
+ - [ ] Define a small semantic theme API for message levels and component colors.
26
+ - [ ] Keep public helpers consistent with the existing `Termline.*` API.
27
+ - [ ] Support explicit width overrides without bypassing terminal-width safety.
28
+ - [ ] Validate component options and return actionable `ArgumentError` messages.
29
+
30
+ ### Quality and documentation
31
+
32
+ - [ ] Add tests for ANSI and plain-text rendering.
33
+ - [ ] Add tests for narrow terminals, redirected output, Unicode content, and interrupted animations.
34
+ - [ ] Add examples to `test/demo_termline.rb`.
35
+ - [ ] Document every new public helper and its builder API.
36
+ - [ ] Update the README screenshot after the P3 components are stable.
37
+ - [ ] Confirm that the final gem still has no runtime dependencies.
38
+
39
+ ### Definition of done
40
+
41
+ - [ ] All builders return strings without writing directly to the terminal.
42
+ - [ ] Dynamic output degrades cleanly outside a TTY.
43
+ - [ ] Existing P0–P2 APIs remain backward compatible.
44
+ - [ ] The complete test suite passes on every supported Ruby version.
45
+ - [ ] README, focused guides, demo, and packaged gem reflect the final P3 API.
46
+
47
+ ### Out of scope
48
+
49
+ - HTML- or Tailwind-style markup parsing.
50
+ - A virtual component tree or terminal DOM.
51
+ - Full-screen terminal application management.
52
+ - Required runtime dependencies.
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-10-20 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: "Termline is a lightweight Ruby gem for printing terminal messages with
13
14
  \ncolors, icons, and semantic log levels.\n"
@@ -18,13 +19,18 @@ extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - lib/termline.rb
22
+ - lib/termline/details.rb
21
23
  - lib/termline/list.rb
22
24
  - lib/termline/msg.rb
23
25
  - lib/termline/space.rb
24
26
  - lib/termline/style.rb
25
27
  - lib/termline/table.rb
28
+ - lib/termline/terminal.rb
29
+ - lib/termline/text.rb
26
30
  - lib/termline/version.rb
31
+ - license.txt
27
32
  - readme.md
33
+ - todo.md
28
34
  homepage: https://www.lesli.dev/
29
35
  licenses:
30
36
  - GPL-3.0-or-later
@@ -34,6 +40,7 @@ metadata:
34
40
  source_code_uri: https://github.com/LesliTech/Termline
35
41
  bug_tracker_uri: https://github.com/LesliTech/Termline/issues
36
42
  documentation_uri: https://www.lesli.dev/gems/termline/
43
+ post_install_message:
37
44
  rdoc_options: []
38
45
  require_paths:
39
46
  - lib
@@ -41,14 +48,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
41
48
  requirements:
42
49
  - - ">="
43
50
  - !ruby/object:Gem::Version
44
- version: '0'
51
+ version: 2.7.2
45
52
  required_rubygems_version: !ruby/object:Gem::Requirement
46
53
  requirements:
47
54
  - - ">="
48
55
  - !ruby/object:Gem::Version
49
56
  version: '0'
50
57
  requirements: []
51
- rubygems_version: 3.7.1
58
+ rubygems_version: 3.5.16
59
+ signing_key:
52
60
  specification_version: 4
53
61
  summary: Human-friendly terminal logs for the Lesli Platform.
54
62
  test_files: []