blob: 5771fe3e4a8b6bf2b865aeae94579d3c6b222615 (
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
|
export const description = `Update data files in-place to satisfy formatting rules for curated URLs`;
import {logInfo} from '#cli';
import {reformatCuratedURLs} from '#reformat-urls';
export async function go({
dataPath,
tidyingOnly,
}) {
const changedFiles =
await reformatCuratedURLs({
dataPath,
showChangedFiles: true,
showSatisfiedRules: tidyingOnly,
});
if (changedFiles.size === 0) {
if (tidyingOnly) {
logInfo`All URL formatting rules were already satisfied. Good to go!`;
return 'clean';
} else {
logInfo`All curated URL formatting rules are satisfied - nice!`;
return 'clean';
}
} else {
const filesPart =
(changedFiles.size === 1
? `1 file`
: `${changedFiles.size} files`);
logInfo`Updated ${filesPart} to satisfy URL formatting rules.`;
return 'updated';
}
}
|