Skip to content

Commit 4c3a2cd

Browse files
committed
Change note creation script uses EDITOR environment variable
Changes the script for creating change notes to read the EDITOR environment variable, and use the editor specified therein. This makes the script more convenient when used from a terminal. The VSCode task is updated to the set EDITOR to `code -r` which preserves the current behavior.
1 parent 4a9be40 commit 4c3a2cd

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.vscode/tasks.json

+10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
"${input:name}",
5151
"${input:categoryQuery}"
5252
],
53+
"options": {
54+
"env": {
55+
"EDITOR": "code -r",
56+
}
57+
},
5358
"presentation": {
5459
"reveal": "never",
5560
"close": true
@@ -67,6 +72,11 @@
6772
"${input:name}",
6873
"${input:categoryLibrary}"
6974
],
75+
"options": {
76+
"env": {
77+
"EDITOR": "code -r"
78+
}
79+
},
7080
"presentation": {
7181
"reveal": "never",
7282
"close": true

misc/scripts/create-change-note.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

3-
# Creates a change note and opens it in VSCode for editing.
3+
# Creates a change note and opens it in $EDITOR (or VSCode if the environment
4+
# variable is not set) for editing.
45

56
# Expects to receive the following arguments:
67
# - What language the change note is for
@@ -51,5 +52,6 @@
5152
with open(change_note_file, "w") as f:
5253
f.write(change_note)
5354

54-
# Open the change note file in VSCode, reusing the existing window if possible
55-
os.system(f"code -r {change_note_file}")
55+
editor = os.environ.get('EDITOR', 'code')
56+
57+
os.system(f"{editor} {change_note_file}")

0 commit comments

Comments
 (0)