709 B34 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import type {CommandArg, RepoRelativePath} from '../types';
9
10import {Operation} from './Operation';
11
12export class RmOperation extends Operation {
13 constructor(
14 private filePath: RepoRelativePath,
15 private force: boolean,
16 ) {
17 super('RmOperation');
18 }
19
20 static opName = 'Rm';
21
22 getArgs() {
23 const args: Array<CommandArg> = ['rm'];
24 if (this.force) {
25 args.push('-f');
26 }
27 args.push({
28 type: 'repo-relative-file' as const,
29 path: this.filePath,
30 });
31 return args;
32 }
33}
34