summaryrefslogtreecommitdiff
path: root/support/arara/scripts/rules/arara-rule-copy.yaml
blob: 74abbcbc14cd0b8a8e3042e45d14ddf8b0dc1aa4 (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) 2023, 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).normalize();
        if (getOriginalReference().equals(f)) {
            throwError('I cannot overwrite the main file reference.');
        }
        return getCommand(prefix, reference, f);
    }
arguments:
- identifier: target
  flag: >
    @{
        return parameters.target;
    }
  required: true