Class: AsciinemaWin::CLI
- Inherits:
-
Object
- Object
- AsciinemaWin::CLI
- Defined in:
- lib/asciinema_win/cli.rb
Overview
Command-line interface for asciinema-win
Provides commands for recording, playing back, and inspecting terminal recordings. Uses only Ruby standard library for argument parsing (no external gems).
Defined Under Namespace
Modules: Colors
Constant Summary collapse
- COMMANDS =
Available commands
%w[rec play cat info export help version].freeze
Class Method Summary collapse
-
.run(args) ⇒ Integer
Run the CLI with the given arguments.
Instance Method Summary collapse
-
#run(args) ⇒ Integer
Run the CLI.
Class Method Details
.run(args) ⇒ Integer
Run the CLI with the given arguments
31 32 33 |
# File 'lib/asciinema_win/cli.rb', line 31 def self.run(args) new.run(args) end |
Instance Method Details
#run(args) ⇒ Integer
Run the CLI
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/asciinema_win/cli.rb', line 39 def run(args) if args.empty? print_usage return 0 end command = args.shift case command when "rec", "record" cmd_rec(args) when "play" cmd_play(args) when "cat" cmd_cat(args) when "info" cmd_info(args) when "export" cmd_export(args) when "help", "-h", "--help" cmd_help(args) when "version", "-v", "--version" cmd_version else error("Unknown command: #{command}") print_usage 1 end rescue StandardError => e error(e.) error(e.backtrace.first(5).join("\n")) if ENV["DEBUG"] 1 end |