addons/isl/src/operations/ResolveInExternalMergeToolOperation.tsblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import type {CommandArg, RepoRelativePath} from '../types';
b69ab319
b69ab3110import {Operation} from './Operation';
b69ab3111
b69ab3112export class ResolveInExternalMergeToolOperation extends Operation {
b69ab3113 constructor(
b69ab3114 private tool: string,
b69ab3115 private filePath?: RepoRelativePath,
b69ab3116 ) {
b69ab3117 super('ResolveInExternalMergeToolOperation');
b69ab3118 }
b69ab3119
b69ab3120 static opName = 'ResolveInExternalMergeToolOperation';
b69ab3121
b69ab3122 getArgs() {
b69ab3123 const args: Array<CommandArg> = [
b69ab3124 'resolve',
b69ab3125 '--tool',
b69ab3126 this.tool,
b69ab3127 // skip merge drivers, since we're just looking to resolve in the UI.
b69ab3128 '--skip',
b69ab3129 ];
b69ab3130
b69ab3131 if (this.filePath) {
b69ab3132 args.push({
b69ab3133 type: 'repo-relative-file' as const,
b69ab3134 path: this.filePath,
b69ab3135 });
b69ab3136 } else {
b69ab3137 args.push('--all');
b69ab3138 }
b69ab3139 return args;
b69ab3140 }
b69ab3141}