Skip to content

Commit 5fca316

Browse files
authored
Folders, Import/Export (#20)
* folders [wip] * use biomejs * reformat files * Folders [WIP] * Reduce commands * feature complete folders * bump version * add keywords * reformat * error handling * import export * fix import/export * fix * bump version
1 parent bede2a7 commit 5fca316

50 files changed

Lines changed: 1700 additions & 1179 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
1010
"typescript.tsc.autoDetect": "off",
1111
"i18n-ally.localesPaths": "",
12-
"cmake.configureOnOpen": true
12+
"cmake.configureOnOpen": true,
13+
"svg.preview.background": "white"
1314
}

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
All notable changes to the "save-commands" extension will be documented in this file.
44

5+
## [1.0.0]
6+
- Create Folders
7+
- Import/Export
8+
59
## [0.5.0]
610
- Add setting to change placeholder capturing group
711

812
## [0.4.1]
913
- Add Placeholder
1014

1115
## [0.0.1]
12-
1316
- Initial release

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ VSCode Extension to save and copy terminal commands.
88

99
# Placeholders
1010

11-
Now you can add placeholders in your commands. For eg, you can add commands in this manner
11+
You can add placeholders in your commands. For eg, you can add commands in this manner
1212
`This is {placeholder1} and {placeholder2} with {placeholder1} again`
1313
It will ask input for `placeholder1` and `placeholder2`
1414

1515
You can set `save-commands.placeholderType` to change the capturing group in settings.
1616

17+
18+
# Import/Export
19+
20+
You can import and export your commands.
21+
**Export**: Click on the 3 dots, Select Export, Save it as `.json` file
22+
**Import**: Click on the 3 dots, Select Import, Select the `.json` file
23+
24+
Note: If you only want to replace only one of workspace commands or global commands, you can edit the json to remove the `global` or `workspace` property and then use it
25+
1726
---
1827

1928
**Enjoy!**

biome.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true
10+
}
11+
},
12+
"files": {
13+
"ignore": ["dist/**/*", "node_modules/**/*", "out/**/*", "build/**/*"]
14+
}
15+
}

package.json

Lines changed: 106 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
"displayName": "Save Commands",
44
"description": "Simple VSCode Extension to save and execute terminal commands.",
55
"icon": "media/save-commands.png",
6-
"version": "0.5.1",
6+
"version": "1.0.0",
77
"engines": {
88
"vscode": "^1.74.0"
99
},
10-
"categories": [
11-
"Other"
12-
],
10+
"keywords": ["commands", "productivity", "workflows", "terminal"],
11+
"categories": ["Other"],
1312
"main": "./dist/extension.js",
1413
"contributes": {
1514
"configuration": {
@@ -25,12 +24,7 @@
2524
"doubleAngleBraces"
2625
],
2726
"description": "Set placeholder string type. This will be used to detect placeholders in your commands. This won't affect your existing commands",
28-
"enumDescriptions": [
29-
"{name}",
30-
"{{name}}",
31-
"<name>",
32-
"<<name>>"
33-
]
27+
"enumDescriptions": ["{name}", "{{name}}", "<name>", "<<name>>"]
3428
}
3529
}
3630
},
@@ -72,26 +66,17 @@
7266
"category": "Save Commands"
7367
},
7468
{
75-
"command": "save-commands.addGlobalCommand",
76-
"title": "Add Global Command",
69+
"command": "save-commands.editFolder",
70+
"title": "Edit Folder",
7771
"icon": {
78-
"light": "resources/light/add.svg",
79-
"dark": "resources/dark/add.svg"
80-
},
81-
"category": "Save Commands"
82-
},
83-
{
84-
"command": "save-commands.deleteWorkspaceCommands",
85-
"title": "Delete Workspace Commands",
86-
"icon": {
87-
"light": "resources/light/trash.svg",
88-
"dark": "resources/dark/trash.svg"
72+
"light": "resources/light/edit.svg",
73+
"dark": "resources/dark/edit.svg"
8974
},
9075
"category": "Save Commands"
9176
},
9277
{
93-
"command": "save-commands.deleteGlobalCommands",
94-
"title": "Delete Global Commands",
78+
"command": "save-commands.deleteCommands",
79+
"title": "Delete Commands",
9580
"icon": {
9681
"light": "resources/light/trash.svg",
9782
"dark": "resources/dark/trash.svg"
@@ -124,6 +109,42 @@
124109
"light": "resources/light/copy.svg",
125110
"dark": "resources/dark/copy.svg"
126111
}
112+
},
113+
{
114+
"command": "save-commands.addFolder",
115+
"title": "Add Folder",
116+
"category": "Save Commands",
117+
"icon": {
118+
"light": "resources/light/new_folder.svg",
119+
"dark": "resources/dark/new_folder.svg"
120+
}
121+
},
122+
{
123+
"command": "save-commands.deleteFolder",
124+
"title": "Delete Folder",
125+
"category": "Save Commands",
126+
"icon": {
127+
"light": "resources/light/trash.svg",
128+
"dark": "resources/dark/trash.svg"
129+
}
130+
},
131+
{
132+
"command": "save-commands.export",
133+
"title": "Export",
134+
"category": "Save Commands",
135+
"icon": {
136+
"light": "resources/light/export.svg",
137+
"dark": "resources/dark/export.svg"
138+
}
139+
},
140+
{
141+
"command": "save-commands.import",
142+
"title": "Import",
143+
"category": "Save Commands",
144+
"icon": {
145+
"light": "resources/light/import.svg",
146+
"dark": "resources/dark/import.svg"
147+
}
127148
}
128149
],
129150
"views": {
@@ -144,6 +165,10 @@
144165
"command": "save-commands.deleteCommand",
145166
"when": "false"
146167
},
168+
{
169+
"command": "save-commands.deleteCommands",
170+
"when": "false"
171+
},
147172
{
148173
"command": "save-commands.editCommand",
149174
"when": "false"
@@ -161,15 +186,46 @@
161186
"when": "false"
162187
},
163188
{
164-
"command": "save-commands.reset",
189+
"command": "save-commands.reset"
190+
},
191+
{
192+
"command": "save-commands.addFolder",
165193
"when": "false"
194+
},
195+
{
196+
"command": "save-commands.deleteFolder",
197+
"when": "false"
198+
},
199+
{
200+
"command": "save-commands.addCommand",
201+
"when": "false"
202+
},
203+
{
204+
"command": "save-commands.editFolder",
205+
"when": "false"
206+
},
207+
{
208+
"command": "save-commands.import"
209+
},
210+
{
211+
"command": "save-commands.export"
166212
}
167213
],
168214
"view/title": [
169215
{
170216
"command": "save-commands.reset",
171217
"when": "view == save-commands-view"
172218
},
219+
{
220+
"command": "save-commands.export",
221+
"when": "view == save-commands-view",
222+
"group": "Backup"
223+
},
224+
{
225+
"command": "save-commands.import",
226+
"when": "view == save-commands-view",
227+
"group": "Backup"
228+
},
173229
{
174230
"command": "save-commands.refreshView",
175231
"when": "view == save-commands-view",
@@ -179,46 +235,48 @@
179235
"view/item/context": [
180236
{
181237
"command": "save-commands.editCommand",
182-
"when": "view == save-commands-view && viewItem == child-global || viewItem == child-workspace"
238+
"when": "view == save-commands-view && viewItem == command"
183239
},
184240
{
185241
"command": "save-commands.deleteCommand",
186-
"when": "view == save-commands-view && viewItem == child-global || viewItem == child-workspace"
242+
"when": "view == save-commands-view && viewItem == command"
243+
},
244+
{
245+
"command": "save-commands.deleteFolder",
246+
"when": "view == save-commands-view && viewItem == folder"
247+
},
248+
{
249+
"command": "save-commands.editFolder",
250+
"when": "view == save-commands-view && viewItem == folder"
187251
},
188252
{
189253
"command": "save-commands.copyCommand",
190-
"when": "view == save-commands-view && viewItem == child-global || viewItem == child-workspace",
254+
"when": "view == save-commands-view && viewItem == command",
191255
"group": "inline"
192256
},
193257
{
194258
"command": "save-commands.runCommand",
195259
"group": "inline",
196-
"when": "view == save-commands-view && viewItem == child-global || viewItem == child-workspace"
260+
"when": "view == save-commands-view && viewItem == command"
197261
},
198262
{
199263
"command": "save-commands.runCommandInActiveTerminal",
200264
"group": "inline",
201-
"when": "view == save-commands-view && viewItem == child-global || viewItem == child-workspace"
265+
"when": "view == save-commands-view && viewItem == command"
202266
},
203267
{
204268
"command": "save-commands.addCommand",
205269
"group": "inline",
206-
"when": "view == save-commands-view && viewItem == parent-workspace"
270+
"when": "view == save-commands-view && viewItem == root || viewItem == folder"
207271
},
208272
{
209-
"command": "save-commands.addGlobalCommand",
210-
"group": "inline",
211-
"when": "view == save-commands-view && viewItem == parent-global"
212-
},
213-
{
214-
"command": "save-commands.deleteWorkspaceCommands",
215-
"group": "inline",
216-
"when": "view == save-commands-view && viewItem == parent-workspace"
273+
"command": "save-commands.deleteCommands",
274+
"when": "view == save-commands-view && viewItem == root"
217275
},
218276
{
219-
"command": "save-commands.deleteGlobalCommands",
277+
"command": "save-commands.addFolder",
220278
"group": "inline",
221-
"when": "view == save-commands-view && viewItem == parent-global"
279+
"when": "view == save-commands-view && viewItem == root || viewItem == folder"
222280
}
223281
]
224282
}
@@ -231,20 +289,22 @@
231289
"test-compile": "tsc -p ./",
232290
"test-watch": "tsc -watch -p ./",
233291
"pretest": "yarn run test-compile && yarn run lint",
234-
"lint": "eslint src --ext ts",
292+
"lint": "biome lint ./src",
293+
"lint:fix": "biome lint --write --unsafe ./src",
294+
"format": "biome format --write ./src",
235295
"test": "node ./out/test/runTest.js",
236296
"unit-test": "mocha"
237297
},
238298
"devDependencies": {
239-
"@types/glob": "^7.2.0",
299+
"@biomejs/biome": "^1.8.3",
300+
"@types/glob": "^8.1.0",
240301
"@types/mocha": "^9.1.1",
241302
"@types/node": "^18.6.4",
242303
"@types/vscode": "^1.74.0",
243304
"@typescript-eslint/eslint-plugin": "^5.59.0",
244305
"@typescript-eslint/parser": "^5.59.0",
245306
"@vscode/test-electron": "^2.1.5",
246-
"eslint": "^8.21.0",
247-
"glob": "^8.0.3",
307+
"glob": "^11.0.0",
248308
"mocha": "^10.2.0",
249309
"ts-loader": "^9.4.2",
250310
"ts-node": "^10.9.1",

resources/dark/export.svg

Lines changed: 4 additions & 0 deletions
Loading

resources/dark/folder.svg

Lines changed: 3 additions & 0 deletions
Loading

resources/dark/import.svg

Lines changed: 4 additions & 0 deletions
Loading

resources/dark/new_folder.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)