-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcomposer.ts
41 lines (32 loc) · 1.01 KB
/
composer.ts
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
39
40
41
import { flags } from "@oclif/command";
import * as shelljs from "shelljs";
import BaseCommand from "./command-base";
export default class Composer extends BaseCommand {
static description = "Executes a Composer command in the current directory";
static strict = false;
static flags = {
["command-help"]: flags.boolean({
char: "h",
description: "Passes --help to the underlying composer command"
})
};
static args = [
{
name: "command",
description:
"The command to pass to composer. Omit this to see available commands",
required: false
}
];
async run() {
const { argv, flags } = this.parse(Composer);
const combined = argv.join(" ");
let commandText = `docker container run --rm ${
!this.config.windows ? "--user $(id -u):$(id -g)" : ""
} -v ${this.currentDirectory}:/app composer ${combined}`;
if (flags["command-help"]) {
commandText = commandText = `${commandText} --help`;
}
shelljs.exec(commandText);
}
}