asciinema_win 0.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 +7 -0
- data/README.md +575 -0
- data/exe/asciinema_win +17 -0
- data/lib/asciinema_win/ansi_parser.rb +437 -0
- data/lib/asciinema_win/asciicast.rb +537 -0
- data/lib/asciinema_win/cli.rb +591 -0
- data/lib/asciinema_win/export.rb +780 -0
- data/lib/asciinema_win/output_organizer.rb +276 -0
- data/lib/asciinema_win/player.rb +348 -0
- data/lib/asciinema_win/recorder.rb +480 -0
- data/lib/asciinema_win/screen_buffer.rb +375 -0
- data/lib/asciinema_win/themes.rb +334 -0
- data/lib/asciinema_win/version.rb +6 -0
- data/lib/asciinema_win.rb +153 -0
- data/lib/rich/_palettes.rb +148 -0
- data/lib/rich/box.rb +342 -0
- data/lib/rich/cells.rb +512 -0
- data/lib/rich/color.rb +628 -0
- data/lib/rich/color_triplet.rb +220 -0
- data/lib/rich/console.rb +549 -0
- data/lib/rich/control.rb +332 -0
- data/lib/rich/json.rb +254 -0
- data/lib/rich/layout.rb +314 -0
- data/lib/rich/markdown.rb +509 -0
- data/lib/rich/markup.rb +175 -0
- data/lib/rich/panel.rb +311 -0
- data/lib/rich/progress.rb +430 -0
- data/lib/rich/segment.rb +387 -0
- data/lib/rich/style.rb +433 -0
- data/lib/rich/syntax.rb +1145 -0
- data/lib/rich/table.rb +525 -0
- data/lib/rich/terminal_theme.rb +126 -0
- data/lib/rich/text.rb +433 -0
- data/lib/rich/tree.rb +220 -0
- data/lib/rich/version.rb +5 -0
- data/lib/rich/win32_console.rb +859 -0
- data/lib/rich.rb +108 -0
- metadata +123 -0
data/lib/rich.rb
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Rich - A Ruby library for rich text and beautiful formatting in the terminal.
|
|
4
|
+
#
|
|
5
|
+
# Rich provides a simple API for adding color and style to terminal output.
|
|
6
|
+
# It supports true color (24-bit), 256-color, and 16-color terminals with
|
|
7
|
+
# automatic fallback. Full Windows Console API support included.
|
|
8
|
+
#
|
|
9
|
+
# @example Basic usage
|
|
10
|
+
# require 'rich'
|
|
11
|
+
#
|
|
12
|
+
# Rich.print("[bold red]Hello[/] [green]World[/]!")
|
|
13
|
+
# Rich.print("[italic blue on white]Styled text[/]")
|
|
14
|
+
#
|
|
15
|
+
# @example Using the Console directly
|
|
16
|
+
# console = Rich::Console.new
|
|
17
|
+
# console.print("Hello", style: "bold magenta")
|
|
18
|
+
#
|
|
19
|
+
# @example Tables
|
|
20
|
+
# table = Rich::Table.new(title: "Users")
|
|
21
|
+
# table.add_column("Name")
|
|
22
|
+
# table.add_column("Age")
|
|
23
|
+
# table.add_row("Alice", "30")
|
|
24
|
+
# Rich.print(table)
|
|
25
|
+
|
|
26
|
+
require_relative "rich/version"
|
|
27
|
+
require_relative "rich/color_triplet"
|
|
28
|
+
require_relative "rich/_palettes"
|
|
29
|
+
require_relative "rich/color"
|
|
30
|
+
require_relative "rich/terminal_theme"
|
|
31
|
+
require_relative "rich/style"
|
|
32
|
+
require_relative "rich/cells"
|
|
33
|
+
require_relative "rich/control"
|
|
34
|
+
require_relative "rich/segment"
|
|
35
|
+
require_relative "rich/text"
|
|
36
|
+
require_relative "rich/markup"
|
|
37
|
+
require_relative "rich/box"
|
|
38
|
+
require_relative "rich/panel"
|
|
39
|
+
require_relative "rich/table"
|
|
40
|
+
require_relative "rich/progress"
|
|
41
|
+
require_relative "rich/tree"
|
|
42
|
+
require_relative "rich/json"
|
|
43
|
+
require_relative "rich/layout"
|
|
44
|
+
require_relative "rich/syntax"
|
|
45
|
+
require_relative "rich/markdown"
|
|
46
|
+
require_relative "rich/win32_console" if Gem.win_platform?
|
|
47
|
+
|
|
48
|
+
module Rich
|
|
49
|
+
class << self
|
|
50
|
+
# Global console instance
|
|
51
|
+
# @return [Console, nil]
|
|
52
|
+
attr_accessor :console
|
|
53
|
+
|
|
54
|
+
# Get or create the global console
|
|
55
|
+
# @return [Console]
|
|
56
|
+
def get_console
|
|
57
|
+
@console ||= Console.new
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Reconfigure the global console
|
|
61
|
+
# @param kwargs [Hash] Console options
|
|
62
|
+
# @return [void]
|
|
63
|
+
def reconfigure(**kwargs)
|
|
64
|
+
@console = Console.new(**kwargs)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Print to the console with markup support
|
|
68
|
+
# @param objects [Array] Objects to print
|
|
69
|
+
# @param sep [String] Separator between objects
|
|
70
|
+
# @param end_str [String] End of line string
|
|
71
|
+
# @param style [String, Style, nil] Style to apply
|
|
72
|
+
# @param highlight [Boolean] Enable highlighting
|
|
73
|
+
# @return [void]
|
|
74
|
+
def print(*objects, sep: " ", end_str: "\n", style: nil, highlight: true)
|
|
75
|
+
get_console.print(*objects, sep: sep, end_str: end_str, style: style, highlight: highlight)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Print JSON with syntax highlighting
|
|
79
|
+
# @param json [String, nil] JSON string
|
|
80
|
+
# @param data [Object] Object to convert to JSON
|
|
81
|
+
# @param indent [Integer] Indentation level
|
|
82
|
+
# @return [void]
|
|
83
|
+
def print_json(json = nil, data: nil, indent: 2)
|
|
84
|
+
get_console.print_json(json, data: data, indent: indent)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Inspect an object and print its details
|
|
88
|
+
# @param obj [Object] Object to inspect
|
|
89
|
+
# @param title [String, nil] Title
|
|
90
|
+
# @param methods [Boolean] Show methods
|
|
91
|
+
# @param docs [Boolean] Show documentation
|
|
92
|
+
# @return [void]
|
|
93
|
+
def inspect(obj, title: nil, methods: false, docs: true)
|
|
94
|
+
get_console.inspect(obj, title: title, methods: methods, docs: docs)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Create a rule/separator line
|
|
98
|
+
# @param title [String] Title text
|
|
99
|
+
# @param style [String] Style for the rule
|
|
100
|
+
# @return [void]
|
|
101
|
+
def rule(title = "", style: "rule.line")
|
|
102
|
+
get_console.rule(title, style: style)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Auto-require Console after base modules are loaded
|
|
108
|
+
require_relative "rich/console"
|
metadata
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: asciinema_win
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- tigel-agm
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: minitest
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '5.0'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '5.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rake
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '13.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '13.0'
|
|
40
|
+
description: |
|
|
41
|
+
A zero-dependency terminal recording and playback system for Windows.
|
|
42
|
+
Uses native Win32 Console APIs via Fiddle for screen buffer capture
|
|
43
|
+
and integrates Rich-Ruby for terminal rendering. Produces recordings
|
|
44
|
+
compatible with asciinema's asciicast v2 format.
|
|
45
|
+
|
|
46
|
+
Features:
|
|
47
|
+
- Record terminal sessions with accurate timing
|
|
48
|
+
- Play back recordings with speed control
|
|
49
|
+
- Export to asciicast v2 format (compatible with asciinema.org)
|
|
50
|
+
- Zero external dependencies
|
|
51
|
+
- Full Windows Console API integration
|
|
52
|
+
- ANSI color support across Windows Terminal, PowerShell, and CMD
|
|
53
|
+
email:
|
|
54
|
+
- tigel-agm
|
|
55
|
+
executables:
|
|
56
|
+
- asciinema_win
|
|
57
|
+
extensions: []
|
|
58
|
+
extra_rdoc_files: []
|
|
59
|
+
files:
|
|
60
|
+
- README.md
|
|
61
|
+
- exe/asciinema_win
|
|
62
|
+
- lib/asciinema_win.rb
|
|
63
|
+
- lib/asciinema_win/ansi_parser.rb
|
|
64
|
+
- lib/asciinema_win/asciicast.rb
|
|
65
|
+
- lib/asciinema_win/cli.rb
|
|
66
|
+
- lib/asciinema_win/export.rb
|
|
67
|
+
- lib/asciinema_win/output_organizer.rb
|
|
68
|
+
- lib/asciinema_win/player.rb
|
|
69
|
+
- lib/asciinema_win/recorder.rb
|
|
70
|
+
- lib/asciinema_win/screen_buffer.rb
|
|
71
|
+
- lib/asciinema_win/themes.rb
|
|
72
|
+
- lib/asciinema_win/version.rb
|
|
73
|
+
- lib/rich.rb
|
|
74
|
+
- lib/rich/_palettes.rb
|
|
75
|
+
- lib/rich/box.rb
|
|
76
|
+
- lib/rich/cells.rb
|
|
77
|
+
- lib/rich/color.rb
|
|
78
|
+
- lib/rich/color_triplet.rb
|
|
79
|
+
- lib/rich/console.rb
|
|
80
|
+
- lib/rich/control.rb
|
|
81
|
+
- lib/rich/json.rb
|
|
82
|
+
- lib/rich/layout.rb
|
|
83
|
+
- lib/rich/markdown.rb
|
|
84
|
+
- lib/rich/markup.rb
|
|
85
|
+
- lib/rich/panel.rb
|
|
86
|
+
- lib/rich/progress.rb
|
|
87
|
+
- lib/rich/segment.rb
|
|
88
|
+
- lib/rich/style.rb
|
|
89
|
+
- lib/rich/syntax.rb
|
|
90
|
+
- lib/rich/table.rb
|
|
91
|
+
- lib/rich/terminal_theme.rb
|
|
92
|
+
- lib/rich/text.rb
|
|
93
|
+
- lib/rich/tree.rb
|
|
94
|
+
- lib/rich/version.rb
|
|
95
|
+
- lib/rich/win32_console.rb
|
|
96
|
+
homepage: https://github.com/tigel-agm/asciinema-win
|
|
97
|
+
licenses:
|
|
98
|
+
- MIT
|
|
99
|
+
metadata:
|
|
100
|
+
homepage_uri: https://github.com/tigel-agm/asciinema-win
|
|
101
|
+
source_code_uri: https://github.com/tigel-agm/asciinema-win
|
|
102
|
+
changelog_uri: https://github.com/tigel-agm/asciinema-win/blob/main/CHANGELOG.md
|
|
103
|
+
bug_tracker_uri: https://github.com/tigel-agm/asciinema-win/issues
|
|
104
|
+
documentation_uri: https://github.com/tigel-agm/asciinema-win#readme
|
|
105
|
+
rubygems_mfa_required: 'true'
|
|
106
|
+
rdoc_options: []
|
|
107
|
+
require_paths:
|
|
108
|
+
- lib
|
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
|
+
requirements:
|
|
111
|
+
- - ">="
|
|
112
|
+
- !ruby/object:Gem::Version
|
|
113
|
+
version: 3.4.0
|
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: '0'
|
|
119
|
+
requirements: []
|
|
120
|
+
rubygems_version: 3.6.9
|
|
121
|
+
specification_version: 4
|
|
122
|
+
summary: Native Windows terminal recorder in pure Ruby
|
|
123
|
+
test_files: []
|