From 90c340a4da52bfc5c11d7310a8f7a791d55008dd Mon Sep 17 00:00:00 2001 From: RezaKargar Date: Thu, 16 Sep 2021 13:04:01 +0430 Subject: [PATCH] Add support for '-d' and '--delete' in git tag This commit resolves #116 by adding support for '-d' and '--delete' in git tag command --- js/controlbox.js | 6 ++++++ js/historyview.js | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/js/controlbox.js b/js/controlbox.js index c9761bf..922edd7 100644 --- a/js/controlbox.js +++ b/js/controlbox.js @@ -506,6 +506,12 @@ function(_yargs, d3, demos) { while (args.length > 0) { var arg = args.shift(); + + if(arg.trim() === '-d' || arg.trim() === '--delete'){ + var tagName = args.shift(); + this.getRepoView().deleteTag(tagName); + return this; + } try { this.getRepoView().tag(arg); diff --git a/js/historyview.js b/js/historyview.js index 7687ac1..c50612a 100644 --- a/js/historyview.js +++ b/js/historyview.js @@ -1228,6 +1228,16 @@ define(['d3'], function() { this.branch('[' + name + ']'); }, + deleteTag: function(name) { + this.branches = this.branches.filter(branch => branch !== `[${name.trim()}]`); + + this.commitData.forEach(commit => { + commit.tags = commit.tags.filter(tag => tag !== `[${name.trim()}]`) + }); + + this.renderTags(); + }, + deleteBranch: function(name) { var branchIndex, commit;