Skip to content

Commit

Permalink
1.3.18
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Feb 20, 2021
1 parent da17e5a commit 042192e
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 37 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ When your editor closes or you close `git peek`, it deletes the repository from
### Changelog
##### `1.3.18`
- Add support for BBCode on macOS
- Adjust location for the shim that opens git-peek on macOS from extension (thanks @JayBrown)
##### `1.3.14 - 1.3.17`
- Fix $EDITOR detection bug
Expand Down
52 changes: 26 additions & 26 deletions bin/git-peek

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/git-peek.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/registerProtocol.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/registerProtocol.js.map

Large diffs are not rendered by default.

32 changes: 27 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,18 @@ const HOME =

const GIT_PEEK_ENV_PATH = path.join(HOME, ".git-peek");

let editorsToTry = ["code", "subl", "nvim", "code-insiders", "vim", "vi"];
let PLATFORM_SPECIFIC_EDITORS = {
darwin: ["BBEdit"],
};
let editorsToTry = [
"code",
"subl",
"nvim",
"code-insiders",
...(PLATFORM_SPECIFIC_EDITORS[process.platform] || []),
"vim",
"vi",
];

let shouldKeep = false;

Expand Down Expand Up @@ -180,6 +191,7 @@ enum EditorMode {
vscode = 1,
sublime = 2,
vim = 3,
bbedit = 4,
}

function githubFetch(url) {
Expand Down Expand Up @@ -817,6 +829,15 @@ to the appropriate URLs.
editorSpecificCommands.push(`"${path.resolve(openPath)}":0:0`);
}
// TODO: handle go to specific line for vim.
} else if (chosenEditor.includes("BBEdit")) {
this.editorMode = EditorMode.bbedit;
exitBehavior.confirm = cli.flags.confirm;
exitBehavior.waitFor = WaitFor.childProcessExit;
chosenEditor = chosenEditor.replace("--wait", "", "-w", "").trim();
editorSpecificCommands.push("--wait");
// Opening a shell is a little weird when its from the extension
// So instead, we just wait for it to download, and
// rely on tmp dir deleting to reoslve it
} else if (chosenEditor.includes("vi")) {
this.editorMode = EditorMode.vim;
exitBehavior.confirm = cli.flags.confirm;
Expand Down Expand Up @@ -996,10 +1017,11 @@ to the appropriate URLs.
this.slowTask = childProcess.spawn(cmd, {
env: process.env,
shell: true,
windowsHide: true,
stdio: "pipe",
// This line is important! If detached is true, nothing ever happens.
detached: true,
stdio:
exitBehavior.waitFor !== WaitFor.childProcessExit
? "ignore"
: "inherit",
detached: exitBehavior.waitFor === WaitFor.childProcessExit,
cwd,
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/registerProtocol.mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function register(editor: string) {
execSync(installCommand);
}

const gitPeekShim = path.join(APP_DIR, "Contents", "git-peek-shim");
const gitPeekShim = path.join(APP_DIR, "Contents/MacOS", "git-peek-shim");

console.log("Generating AppleScript handler.");
const appleScriptCode = await generateAppleScript(gitPeekShim);
Expand Down

0 comments on commit 042192e

Please sign in to comment.