Skip to content

Commit

Permalink
added except model for preset
Browse files Browse the repository at this point in the history
  • Loading branch information
horacehylee committed Jan 21, 2018
1 parent 6b5713b commit 08b3646
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/commands/preset-usage/exit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ export const ExitCommand: CommandModule = {
return;
}

const killProgramPromises = preset.programs.map(programName =>
let killProgramNames: string[] = preset.programs;
if (
preset.except &&
preset.except.teardown &&
!isEmpty(preset.except.teardown)
) {
killProgramNames = killProgramNames.filter(
programName => !preset.except.teardown.includes(programName)
);
}

const killProgramPromises = killProgramNames.map(programName =>
killProgram(programName)
);
await Promise.all(killProgramPromises);
Expand Down
4 changes: 4 additions & 0 deletions src/modules/workenv/models/except.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export class Except {
setup?: string[];
teardown?: string[];
}
2 changes: 2 additions & 0 deletions src/modules/workenv/models/preset.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Command } from "./command.model";
import { Except } from "./except.model";

export class Preset {
name: string;
programs?: string[];
commands?: Command[];
except?: Except;
}
Empty file.

0 comments on commit 08b3646

Please sign in to comment.