Skip to content

Commit

Permalink
feat: Improve UX a bit by showing notification of what's happening wh…
Browse files Browse the repository at this point in the history
…en user presses hotkey
  • Loading branch information
denolehov committed Oct 27, 2020
1 parent c7e5c04 commit c562e74
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
28 changes: 21 additions & 7 deletions main.js

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class ObsidianGit extends Plugin {
id: 'pull',
name: 'Pull from remote repository',
callback: async () => {
new Notice("Pulling changes from remote repository..");
const pullResult = await this.git.pull("origin");

let filesAffected = pullResult.files.length;
Expand All @@ -35,10 +36,23 @@ export default class ObsidianGit extends Plugin {

this.addCommand({
id: 'push',
name: 'Commit all changes and push to remote repository',
name: 'Commit *all* changes and push to remote repository',
callback: async () => {
const result = await this.git.add('./*').commit("vault backup").push("origin","master", null, () => {new Notice("Pushed!")});
console.log("push:", result);
new Notice("Pushing changes to remote repository..");
await this.git
.add('./*')
.commit("vault backup")
.push("origin","master", null, (err: Error) => {
let message: string;
if (!err) {
message = "Pushed changes to remote repository.";
} else {
message = err.message;
}

new Notice(message);
}
);
}
})
}
Expand Down

0 comments on commit c562e74

Please sign in to comment.