Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,7 @@ Comment on a pull request.
gh pr 1 --comment "Merged, thank you!"
```

Submit a pull request using your default git editor (`git config --global core.editor`) by passing an empty `--comment`

- To disable this functionality of opening your editor add `"use_editor": false` to `~/.gh.json`
Submit a pull request using your [default editor](#set-default-editor-to-use-when-creating-a-new-message) by passing an empty `--comment`

```
gh pr 1 --comment
Expand Down Expand Up @@ -611,9 +609,7 @@ Submit a pull request using the current branch.
gh pr --submit eduardolundgren --title 'Fix #32' --description 'Awesome fix'
```

Submit a pull request using your default git editor (`git config --global core.editor`) by passing an empty `--title` and or `--description`

- To disable this functionality of opening your editor add `"use_editor": false` to `~/.gh.json`
Submit a pull request using your [default editor](#set-default-editor-to-use-when-creating-a-new-message) by passing an empty `--title` and or `--description`

```
gh pr --submit eduardolundgren --title --description
Expand Down Expand Up @@ -744,9 +740,7 @@ gh issue
gh is 'Node GH rocks!' 'Body with **Markdown** support'
```

Create a new issue using your default git editor (`git config --global core.editor`) by passing an empty `--message` (_also works with an empty title_)

- To disable this functionality of opening your editor add `"use_editor": false` to `~/.gh.json`
Create a new issue using your [default editor](#set-default-editor-to-use-when-creating-a-new-message) by passing an empty `--message` (_also works with an empty title_)

```
gh is --new --title 'Node GH rocks!' --message
Expand Down Expand Up @@ -788,9 +782,7 @@ Comment on an issue of the current repository.
gh is 1 --comment 'Node GH rocks!'
```

Comment on an issue using your default git editor (`git config --global core.editor`) by passing an empty `--comment` (_also works with an empty title_)

- To disable this functionality of opening your editor add `"use_editor": false` to `~/.gh.json`
Comment on an issue using your [default editor](#set-default-editor-to-use-when-creating-a-new-message) by passing an empty `--comment` (_also works with an empty title_)

```
gh is 1 --comment
Expand Down Expand Up @@ -1709,6 +1701,12 @@ Required for prompt commands.
"pull_branch_name_prefix": "pr-"
```

### Set default editor to use when creating a new message

- For certain tasks like opening a pull request when you omit the title or description, we will open a new file for you to create the message in.
- We first check enviroment variables for the default editor: `$EDITOR` or `$VISUAL` and fallback to the default git editor `git config --global core.editor`
- To **disable** this functionality of opening your editor add `"use_editor": false` to `~/.gh.json`

### Insert signature below issue comment.

```javascript
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

9 changes: 7 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ export function openFileInEditor(fileName: string, msg: string): string {

writeFileSync(filePath, msg)

const editor = spawnSync('git', ['config', '--global', 'core.editor']).stdout
const editor =
process.env.EDITOR ||
process.env.VISUAL ||
spawnSync('git', ['config', '--global', 'core.editor']).stdout

execSyncInteractiveStream(`${editor} "${filePath}"`)
if (editor) {
execSyncInteractiveStream(`${editor} "${filePath}"`)
}

const newFileContents = readFileSync(filePath).toString()

Expand Down