Skip to content

Commit

Permalink
Make command templates context type aware (microsoft#2176)
Browse files Browse the repository at this point in the history
* Extend cmd customization for context types

* Add unit tests for command template selection
  • Loading branch information
bwateratmsft authored and Dmarch28 committed Mar 4, 2021
1 parent fc594f6 commit 9d5a32c
Show file tree
Hide file tree
Showing 9 changed files with 864 additions and 62 deletions.
2 changes: 2 additions & 0 deletions extension.bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ export { DebugConfigurationBase } from './src/debugging/DockerDebugConfiguration
export { ActivityMeasurementService } from './src/telemetry/ActivityMeasurementService';
export { ExperimentationTelemetry } from './src/telemetry/ExperimentationTelemetry';
export { DockerApiClient } from './src/docker/DockerApiClient';
export { DockerContext, isNewContextType } from './src/docker/Contexts';
export { DockerContainer } from './src/docker/Containers';
export { DockerImage } from './src/docker/Images';
export { DockerNetwork } from './src/docker/Networks';
export { DockerVolume } from './src/docker/Volumes';
export { CommandTemplate, selectCommandTemplate, defaultCommandTemplates } from './src/commands/selectCommandTemplate';

export * from 'vscode-azureextensionui';
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 104 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.build.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand Down Expand Up @@ -1450,6 +1461,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.run.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand Down Expand Up @@ -1482,6 +1504,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.runInteractive.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand Down Expand Up @@ -1514,6 +1547,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.attach.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand Down Expand Up @@ -1546,6 +1590,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.logs.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand Down Expand Up @@ -1578,6 +1633,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.composeUp.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand All @@ -1590,7 +1656,19 @@
"type": "string"
}
],
"default": "docker-compose ${configurationFile} up ${detached} ${build}",
"default": [
{
"label": "Compose Up",
"template": "docker-compose ${configurationFile} up ${detached} ${build}",
"contextTypes": [
"moby"
]
},
{
"label": "Compose Up",
"template": "docker compose ${configurationFile} up ${detached}"
}
],
"description": "%vscode-docker.config.template.composeUp.description%"
},
"docker.commands.composeDown": {
Expand All @@ -1610,6 +1688,17 @@
"match": {
"type": "string",
"description": "%vscode-docker.config.template.composeDown.match%"
},
"contextTypes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"moby",
"aci"
]
},
"description": "%vscode-docker.config.template.contextTypes.description%"
}
},
"required": [
Expand All @@ -1622,7 +1711,19 @@
"type": "string"
}
],
"default": "docker-compose ${configurationFile} down",
"default": [
{
"label": "Compose Down",
"template": "docker-compose ${configurationFile} down",
"contextTypes": [
"moby"
]
},
{
"label": "Compose Down",
"template": "docker compose ${configurationFile} down"
}
],
"description": "%vscode-docker.config.template.composeDown.description%"
},
"docker.containers.groupBy": {
Expand Down Expand Up @@ -2636,7 +2737,7 @@
"typescript": "^3.9.7",
"umd-compat-loader": "^2.1.2",
"vsce": "^1.77.0",
"vscode-azureextensiondev": "^0.4.0",
"vscode-azureextensiondev": "^0.4.1",
"vscode-nls-dev": "^3.3.2",
"vscode-test": "^1.4.0",
"webpack": "^4.43.0",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"vscode-docker.config.template.composeDown.label": "The label displayed to the user.",
"vscode-docker.config.template.composeDown.match": "The regular expression for choosing the right template. Checked against docker-compose YAML files, folder name, etc.",
"vscode-docker.config.template.composeDown.description": "Command templates for `docker-compose down` commands.",
"vscode-docker.config.template.contextTypes.description": "The context types in which the command template applies. If undefined or empty, the template applies in all context types.",
"vscode-docker.config.docker.explorerRefreshInterval": "Docker view refresh interval (milliseconds)",
"vscode-docker.config.docker.containers.groupBy": "The property to use to group containers in Docker view: ContainerId, ContainerName, CreatedTime, FullTag, ImageId, Networks, Ports, Registry, Repository, RepositoryName, RepositoryNameAndTag, State, Status, Tag, or None",
"vscode-docker.config.docker.containers.description": "Any secondary properties to display for a container (an array). Possible elements include: ContainerId, ContainerName, CreatedTime, FullTag, ImageId, Networks, Ports, Registry, Repository, RepositoryName, RepositoryNameAndTag, State, Status, and Tag",
Expand Down
Loading

0 comments on commit 9d5a32c

Please sign in to comment.