Skip to content

Commit

Permalink
refactor: remove duplication, use handleCopy function instead
Browse files Browse the repository at this point in the history
  • Loading branch information
keevan committed Mar 5, 2022
1 parent 0c25a9b commit 98128ef
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions lib/git-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,39 +152,15 @@ export default {
// Open actions (e.g. open in browser)
async linkFile() {
const link = await this.file()
if (!link) {
return false
}

if (this.openLinkOnDoubleCopy && this.openLinkIfMatchesClipboard(link)) {
return
}
atom.clipboard.write(link)
atom.notifications.addInfo('Copied link for current file to clipboard', { detail: link })
this.handleCopy(link, 'Copied link for current file to clipboard')
},
async linkLine() {
const link = await this.line()
if (!link) {
return false
}

if (this.openLinkOnDoubleCopy && this.openLinkIfMatchesClipboard(link)) {
return
}
atom.clipboard.write(link)
atom.notifications.addInfo('Copied link for current line to clipboard', { detail: link })
this.handleCopy(link, 'Copied link for current line to clipboard')
},
async linkSelection() {
const link = await this.selection()
if (!link) {
return false
}

if (this.openLinkOnDoubleCopy && this.openLinkIfMatchesClipboard(link)) {
return
}
atom.clipboard.write(link)
atom.notifications.addInfo('Copied link for current selection to clipboard', { detail: link })
this.handleCopy(link, 'Copied link for current selection to clipboard')
},

async linkRepository() {
Expand Down

0 comments on commit 98128ef

Please sign in to comment.