Class: Rails::Worktrees::CLI
- Inherits:
-
Object
- Object
- Rails::Worktrees::CLI
- Defined in:
- lib/rails/worktrees/cli.rb
Overview
Shell entrypoint for the wt executable.
Constant Summary collapse
- LOADER_OPTIONAL_COMMANDS =
%w[doctor update -h --help -v --version].freeze
- LOADER_IGNORED_FLAGS =
%w[--dry-run --force --skip-setup].freeze
- SETUP_SUBCOMMAND =
'setup'.freeze
Instance Method Summary collapse
-
#initialize(argv: ARGV, io: { stdin: $stdin, stdout: $stdout, stderr: $stderr }, env: ENV, cwd: Dir.pwd) ⇒ CLI
constructor
A new instance of CLI.
- #start ⇒ Object
Constructor Details
#initialize(argv: ARGV, io: { stdin: $stdin, stdout: $stdout, stderr: $stderr }, env: ENV, cwd: Dir.pwd) ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rails/worktrees/cli.rb', line 9 def initialize( argv: ARGV, io: { stdin: $stdin, stdout: $stdout, stderr: $stderr }, env: ENV, cwd: Dir.pwd ) @argv = argv @io = io @env = env @cwd = cwd end |
Instance Method Details
#start ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/rails/worktrees/cli.rb', line 21 def start configuration = ::Rails::Worktrees.configuration load_project_configuration(configuration) if should_load_project_configuration? command_for(configuration).run rescue ::Rails::Worktrees::Error => e @io.fetch(:stderr).puts("Error: #{e.}") 1 end |