-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.json
More file actions
166 lines (166 loc) · 6.42 KB
/
package.json
File metadata and controls
166 lines (166 loc) · 6.42 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{
"name": "context-shell-runner",
"displayName": "Context Shell Runner",
"description": "Run custom shell commands from Explorer context menu with precise file/folder path detection and variable injection.",
"version": "0.0.3",
"publisher": "nicholasjupiter",
"author": {
"name": "NicholasJupiter"
},
"license": "MIT",
"icon": "images/icon.png",
"repository": {
"type": "git",
"url": "https://github.com/NicholasJupiter/context-shell-runner"
},
"bugs": {
"url": "https://github.com/NicholasJupiter/context-shell-runner/issues"
},
"homepage": "https://github.com/NicholasJupiter/context-shell-runner#readme",
"engines": {
"vscode": "^1.108.1"
},
"categories": [
"Other",
"Snippets"
],
"keywords": [
"shell",
"terminal",
"command",
"context menu",
"explorer",
"right-click",
"automation",
"go-zero",
"goctl",
"script runner"
],
"galleryBanner": {
"color": "#667eea",
"theme": "dark"
},
"activationEvents": [],
"main": "./dist/extension.js",
"contributes": {
"commands": [
{
"command": "context-shell-runner.run",
"title": "Context Shell Runner: Run"
}
],
"menus": {
"explorer/context": [
{
"command": "context-shell-runner.run",
"group": "navigation"
}
]
},
"configuration": {
"title": "Context Shell Runner",
"properties": {
"contextShellRunner.commands": {
"type": "object",
"default": {},
"markdownDescription": "自定义 Shell 命令配置。\n\n## 支持的变量\n\n| 变量 | 说明 |\n|------|------|\n| `${path}` | 右键资源的**完整绝对路径** |\n| `${dir}` | 资源所在**目录**(文件返回父目录,文件夹返回自身路径) |\n| `${name}` | 资源的**文件名或文件夹名**(不含路径) |\n| `${isFile}` | 是否为文件(`true` / `false`) |\n| `${isFolder}` | 是否为文件夹(`true` / `false`) |\n| `${workspace}` | 当前 **VS Code 工作区根目录**路径 |\n\n## 路径过滤\n\n| 字段 | 说明 |\n|------|------|\n| `pathContains` | 路径必须**包含**指定字符串 |\n| `pathPattern` | 路径必须匹配 **glob 模式** |\n\n## 配置示例\n\n```json\n\"contextShellRunner.commands\": {\n \"gozero-rpc\": {\n \"description\": \"Generate go-zero rpc\",\n \"command\": \"goctl rpc protoc *.proto\",\n \"when\": \"folder\",\n \"pathContains\": \"proto\"\n },\n \"docker-build\": {\n \"description\": \"Docker Build\",\n \"command\": \"docker build -t ${name} .\",\n \"pathPattern\": \"**/Dockerfile\"\n }\n}\n```",
"additionalProperties": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "命令描述,显示在 QuickPick 选择菜单中"
},
"command": {
"type": "string",
"markdownDescription": "要执行的 shell 命令。支持变量:`${path}` `${dir}` `${name}` `${isFile}` `${isFolder}` `${workspace}`"
},
"when": {
"type": "string",
"enum": [
"file",
"folder",
"any"
],
"default": "any",
"markdownDescription": "命令可用范围:\n- `file` - 仅当右键**文件**时显示\n- `folder` - 仅当右键**文件夹**时显示\n- `any` - 文件和文件夹都显示"
},
"shell": {
"type": "string",
"default": "bash",
"description": "使用的 shell 程序,如 bash、sh、zsh"
},
"loginShell": {
"type": "boolean",
"default": false,
"markdownDescription": "是否使用登录 shell:\n- `true` → 使用 `bash -lc` (加载 .bash_profile 等配置)\n- `false` → 使用 `bash -c`"
},
"pathContains": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"markdownDescription": "路径必须**包含**指定的字符串才显示此命令。\n\n- 字符串:路径包含该字符串\n- 数组:路径包含数组中**任意一个**字符串\n\n示例:\n```json\n\"pathContains\": \"proto\"\n\"pathContains\": [\"proto\", \"api\"]\n```"
},
"pathPattern": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"markdownDescription": "路径必须匹配指定的 **glob 模式**才显示此命令。\n\n- 字符串:路径匹配该模式\n- 数组:路径匹配数组中**任意一个**模式\n\n示例:\n```json\n\"pathPattern\": \"**/proto/**\"\n\"pathPattern\": [\"**/proto/**\", \"**/api/**\"]\n```"
}
},
"required": [
"description",
"command"
]
}
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "npm run check-types && npm run lint && node esbuild.js",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"package": "npm run check-types && npm run lint && node esbuild.js --production",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"check-types": "tsc --noEmit",
"lint": "eslint src",
"test": "vscode-test"
},
"devDependencies": {
"@types/minimatch": "^5.1.2",
"@types/mocha": "^10.0.10",
"@types/node": "22.x",
"@types/vscode": "^1.108.1",
"@vscode/test-cli": "^0.0.12",
"@vscode/test-electron": "^2.5.2",
"esbuild": "^0.27.2",
"eslint": "^9.39.2",
"npm-run-all": "^4.1.5",
"typescript": "^5.9.3",
"typescript-eslint": "^8.52.0"
},
"dependencies": {
"minimatch": "^10.1.1"
}
}