aboutsummaryrefslogtreecommitdiff
path: root/src/content/operators/impls/YankURLOperator.ts
blob: 2e774eb61a9dc158410fbb71d48912dd7ebd83cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Operator from "../Operator";
import ClipboardRepository from "../../repositories/ClipboardRepository";
import ConsoleClient from "../../client/ConsoleClient";
import URLRepository from "./URLRepository";

export default class YankURLOperator implements Operator {
  constructor(
    private readonly repository: ClipboardRepository,
    private readonly consoleClient: ConsoleClient,
    private readonly urlRepository: URLRepository
  ) {}

  async run(): Promise<void> {
    const url = this.urlRepository.getCurrentURL();
    this.repository.write(url);
    await this.consoleClient.info("Yanked " + url);
  }
}