Skip to content

Commit

Permalink
Merge pull request #24 from KyleKing/11-add-command
Browse files Browse the repository at this point in the history
Add Command Palette Commands
  • Loading branch information
rscherf authored Dec 23, 2021
2 parents d2aee5b + e3daa8a commit e2e7c41
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 80 deletions.
145 changes: 94 additions & 51 deletions Context.sublime-menu
Original file line number Diff line number Diff line change
@@ -1,53 +1,96 @@
[
{
"caption" : "-",
"id" : "gitlink-start-separator"
},
{
"caption" : "GitLink",
"id" : "gitlink-options",
"children" :
[
{
"caption" : "Copy Git URL to file",
"id" : "gitlink-link-file",
"command" : "gitlink",
"args" : {
"line" : false,
"web" : false
}
},
{
"caption" : "Copy Git URL to line",
"id" : "gitlink-link-line",
"command" : "gitlink",
"args" : {
"line" : true,
"web" : false
}
},
{
"caption" : "-",
"id" : "gitlink-web-separator"
},
{
"caption" : "Open Git URL to file",
"id" : "gitlink-link-file",
"command" : "gitlink",
"args" : {
"line" : false,
"web" : true
}
},
{
"caption" : "Open Git URL to line",
"id" : "gitlink-link-line",
"command" : "gitlink",
"args" : {
"line" : true,
"web" : true
}
}
]
}
{
"caption": "-",
"id": "gitlink-start-separator"
},
{
"caption": "GitLink",
"id": "gitlink-options",
"children": [
{
"caption": "Copy Git URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": false,
"blame": false
}
},
{
"caption": "Copy Git URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": false,
"blame": false
}
},
{
"caption": "Copy Git Blame URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": false,
"blame": true
}
},
{
"caption": "Copy Git Blame URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": false,
"blame": true
}
},
{
"caption": "-",
"id": "gitlink-web-separator"
},
{
"caption": "Open Git URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": true,
"blame": false
}
},
{
"caption": "Open Git URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": true,
"blame": false
}
},
{
"caption": "Open Git Blame URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": true,
"blame": true
}
},
{
"caption": "Open Git Blame URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": true,
"blame": true
}
}
]
}
]
2 changes: 1 addition & 1 deletion GitLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def run(self, edit, **args):
user, domain = domain.split('.', 1)
else:
# format is {domain}/{user}/{repo}.git
domain, user, repo = remote.split("/")
domain, user, repo = remote.split("://")[-1].split("/")
project = None
print(domain, user, repo)
# Find top level repo in current dir structure
Expand Down
74 changes: 74 additions & 0 deletions GitLink.sublime-commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{
"caption": "GitLink: Copy Git URL to file",
"command": "gitlink",
"args": {
"line": false,
"web": false,
"blame": false
}
},
{
"caption": "GitLink: Open Git URL to file",
"command": "gitlink",
"args": {
"line": false,
"web": true,
"blame": false
}
},
{
"caption": "GitLink: Copy Git URL to line",
"command": "gitlink",
"args": {
"line": true,
"web": false,
"blame": false
}
},
{
"caption": "GitLink: Open Git URL to line",
"command": "gitlink",
"args": {
"line": true,
"web": true,
"blame": false
}
},
{
"caption": "GitLink: Copy Git Blame URL to file",
"command": "gitlink",
"args": {
"line": false,
"web": false,
"blame": true
}
},
{
"caption": "GitLink: Open Git Blame URL to file",
"command": "gitlink",
"args": {
"line": false,
"web": true,
"blame": true
}
},
{
"caption": "GitLink: Copy Git Blame URL to line",
"command": "gitlink",
"args": {
"line": true,
"web": false,
"blame": true
}
},
{
"caption": "GitLink: Open Git Blame URL to line",
"command": "gitlink",
"args": {
"line": true,
"web": true,
"blame": true
}
}
]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Written by Ryan Scherf : <http://ryan.sc> - <http://twitter.com/ryanscherf>
![Right click in side menu](http://f.cl.ly/items/1O100K122E0a1x0y3V1k/Screen%20Shot%202014-10-20%20at%209.46.38%20AM.png)
![Right click in a file](http://f.cl.ly/items/3f1r0h0q1t2J003M2W0A/Screen%20Shot%202014-10-20%20at%209.46.24%20AM.png)

Or search for "GitLink" in the Command Palette

#### Copy URLs to files

`command + shift + c` Right click any file in the sidebar (that is part of a Git repository) and go to the `GitLink` menu item to see options.
Expand Down
122 changes: 94 additions & 28 deletions Side Bar.sublime-menu
Original file line number Diff line number Diff line change
@@ -1,30 +1,96 @@
[
{
"caption" : "-",
"id" : "gitlink-start-separator"
},
{
"caption" : "GitLink",
"id" : "gitlink-options",
"children" :
[
{
"caption" : "Copy Git URL to file",
"id" : "gitlink-link-file",
"command" : "gitlink",
"args" : {
"line" : false
}
},
{
"caption" : "Open Git URL to file",
"id" : "gitlink-link-file",
"command" : "gitlink",
"args" : {
"line" : false,
"web" : true
}
}
]
}
{
"caption": "-",
"id": "gitlink-start-separator"
},
{
"caption": "GitLink",
"id": "gitlink-options",
"children": [
{
"caption": "Copy Git URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": false,
"blame": false
}
},
{
"caption": "Copy Git URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": false,
"blame": false
}
},
{
"caption": "Copy Git Blame URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": false,
"blame": true
}
},
{
"caption": "Copy Git Blame URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": false,
"blame": true
}
},
{
"caption": "-",
"id": "gitlink-web-separator"
},
{
"caption": "Open Git URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": true,
"blame": false
}
},
{
"caption": "Open Git URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": true,
"blame": false
}
},
{
"caption": "Open Git Blame URL to file",
"id": "gitlink-link-file",
"command": "gitlink",
"args": {
"line": false,
"web": true,
"blame": true
}
},
{
"caption": "Open Git Blame URL to line",
"id": "gitlink-link-line",
"command": "gitlink",
"args": {
"line": true,
"web": true,
"blame": true
}
}
]
}
]

0 comments on commit e2e7c41

Please sign in to comment.