summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/arara/rules/arara-rule-move.yaml
blob: 2594b220b02c6bd735514ff180a79c0506fa86ad (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
36
37
38
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2022, Island of TeX
# All rights reserved.
#
# This rule is part of arara.
identifier: move
name: Move
authors:
- Island of TeX
commands:
- name: The OS move call
  command: >
    @{
        prefix = [];
        if (isUnix()) {
            prefix = [ 'mv', '-f' ];
        }
        else {
            prefix = [ 'cmd', '/c', 'move', '/Y' ];
        }
        if (getOriginalReference() == reference) {
            throwError('I cannot move the main file reference.');
        }
        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