mirror of
https://github.com/smogon/sprites.git
synced 2026-04-24 14:57:28 -05:00
deploy: add --link
This commit is contained in:
parent
e4d174f5c5
commit
312cca912d
|
|
@ -7,14 +7,15 @@ function collect(value : string, previous : string[]) {
|
|||
return previous.concat([value]);
|
||||
}
|
||||
|
||||
function runAq(aq : script.ActionQueue, outputDir : undefined | string, verbose : undefined | true) {
|
||||
function runAq(aq : script.ActionQueue, link: boolean, outputDir : undefined | string, verbose : undefined | true) {
|
||||
const level = verbose ? 'all' : 'errors';
|
||||
const copyMode = link ? 'link' : 'copy';
|
||||
if (!aq.valid) {
|
||||
aq.print(level);
|
||||
process.exit(1);
|
||||
}
|
||||
if (outputDir !== undefined) {
|
||||
aq.run(outputDir, 'copy');
|
||||
aq.run(outputDir, copyMode);
|
||||
} else {
|
||||
if (level === 'errors') {
|
||||
console.log(`Success, but nothing to do. Please rerun with -v or -o`);
|
||||
|
|
@ -31,10 +32,11 @@ program
|
|||
.option('-e, --eval <expr>', 'Expr')
|
||||
.option('-m, --module <mod>', 'Module')
|
||||
.option('-v, --verbose', 'Verbose')
|
||||
.option('--link', 'Link')
|
||||
// TODO
|
||||
// .option('-t, --tag <tag>', 'Tag', collect, [])
|
||||
// from rename(1)
|
||||
.action(async (files : string[], {eval: expr, module: mod, output: outputDir, verbose}) => {
|
||||
.action(async (files : string[], {eval: expr, module: mod, output: outputDir, verbose, link}) => {
|
||||
let scr;
|
||||
if (expr !== undefined) {
|
||||
scr = new script.Script(expr, 'expr');
|
||||
|
|
@ -56,14 +58,15 @@ program
|
|||
}
|
||||
}
|
||||
|
||||
runAq(aq, outputDir, verbose);
|
||||
runAq(aq, link, outputDir, verbose);
|
||||
});
|
||||
|
||||
program
|
||||
.command('run [scripts...]')
|
||||
.option('-o, --output <dir>', 'Output directory')
|
||||
.option('-v, --verbose', 'Verbose')
|
||||
.action((scripts : string[], {output: outputDir, verbose}) => {
|
||||
.option('--link', 'Link')
|
||||
.action((scripts : string[], {output: outputDir, verbose, link}) => {
|
||||
const aq = new script.ActionQueue;
|
||||
|
||||
for (const file of scripts) {
|
||||
|
|
@ -76,7 +79,7 @@ program
|
|||
}
|
||||
}
|
||||
|
||||
runAq(aq, outputDir, verbose);
|
||||
runAq(aq, link, outputDir, verbose);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user