summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/arara/rules/arara-rule-copy.yaml
blob: 101a92932b56e5bdf00bc8d48929653757e59ba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2022, Island of TeX
# All rights reserved.
#
# This rule is part of arara.
identifier: copy
name: Copy
authors:
- Island of TeX
commands:
- name: The OS copy call
  command: >
    @{
        prefix = [];
        if (isUnix()) {
            prefix = [ 'cp', '-f' ];
        }
        else {
            prefix = [ 'cmd', '/c', 'copy', '/Y' ];
        }
        t = isList(target) ? target[0] : target;
        f = toFile(t).getCanonicalFile();
        if (getOriginalReference().equals(f)) {
            throwError('I cannot overwrite the main file reference.');
        }
        return getCommand(prefix, reference, t);
    }
arguments:
- identifier: target
  flag: >
    @{
        return parameters.target;
    }
  required: true