Class: Archimate::Diff::Cli::ConflictResolver
- Inherits:
-
Object
- Object
- Archimate::Diff::Cli::ConflictResolver
- Defined in:
- lib/archimate/diff/cli/conflict_resolver.rb
Instance Method Summary collapse
-
#initialize ⇒ ConflictResolver
constructor
A new instance of ConflictResolver.
-
#resolve(conflict) ⇒ Object
TODO: this implementation has much to be written.
Constructor Details
#initialize ⇒ ConflictResolver
Returns a new instance of ConflictResolver.
9 10 11 12 13 |
# File 'lib/archimate/diff/cli/conflict_resolver.rb', line 9 def initialize @config = Config.instance # TODO: pull the stdin/stdout from the app config @hl = HighLine.new(STDIN, STDOUT) end |
Instance Method Details
#resolve(conflict) ⇒ Object
TODO: this implementation has much to be written
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/archimate/diff/cli/conflict_resolver.rb', line 16 def resolve(conflict) return [] unless @config.interactive base_local_diffs = conflict.base_local_diffs base_remote_diffs = conflict.base_remote_diffs choice = @hl.choose do || .prompt = conflict .choice(:local, text: base_local_diffs.map(&:to_s).join("\n\t\t")) .choice(:remote, text: base_remote_diffs.map(&:to_s).join("\n\t\t")) # menu.choice(:neither, help: "Don't choose either set of diffs") # menu.choice(:edit, help: "Edit the diffs (coming soon)") # menu.choice(:quit, help: "I'm in over my head. Just stop!") .select_by = :index_or_name end case choice when :local base_local_diffs when :remote base_remote_diffs else error "Unexpected choice #{choice.inspect}." end end |