Skip to content

Commit

Permalink
fix actions for branch pull/push
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed May 17, 2023
1 parent 68bfb81 commit a8c5397
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The only required parameters per action are `title` and `args`.
"title": "Switch", // Whatever you want to appear on the button itself. Title is also used as a cache key (see `Save` above).
"icon": "arrow-swap", // An icon to display next to the title. Choose one from https://microsoft.github.io/vscode-codicons/dist/codicon.html
"args": "switch '$1'", // The actual command, appended to `git `. This will be executed WITHOUT VALIDATION SO BE CAREFUL. $1, $2 and so on are placeholders for the respective `params`.
"params": [ "{LOCAL_BRANCH_NAME}" ], // Default values for the `args` placeholders. You can write anything here, including special keywords that include: {BRANCH_NAME}, {LOCAL_BRANCH_NAME}, {COMMIT_HASH}, {COMMIT_HASHES}, {STASH_NAME}, {TAG_NAME}, {SOURCE_BRANCH_NAME} and {TARGET_BRANCH_NAME} (where it makes sense).
"params": [ "{LOCAL_BRANCH_NAME}" ], // Default values for the `args` placeholders. You can write anything here, including special keywords that include: {BRANCH_NAME}, {LOCAL_BRANCH_NAME}, {REMOTE_NAME}, {COMMIT_HASH}, {COMMIT_HASHES}, {STASH_NAME}, {TAG_NAME}, {SOURCE_BRANCH_NAME} and {TARGET_BRANCH_NAME} (where it makes sense).
// `options` are just an easy and quick way to toggle common trailing options. You can also specify them manually in `args` of course, given that `args` is also editable yet again at runtime.
"options": [
{ "value": "--detach", "default_active": false },
Expand Down
40 changes: 38 additions & 2 deletions web/src/views/default-git-actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,49 @@
"title": "Pull",
"icon": "fold-down",
"description": "Pull",
"args": "pull"
"args": "pull '$1' '$2'",
"params": [
"{REMOTE_NAME}",
"{LOCAL_BRANCH_NAME}"
],
"options": [
{
"value": "--no-commit",
"default_active": false
},
{
"value": "--no-ff",
"default_active": false
},
{
"value": "--squash",
"default_active": false
}
]
},
{
"title": "Push",
"icon": "fold-up",
"description": "Push",
"args": "push"
"args": "push '$1' '$2'",
"params": [
"{REMOTE_NAME}",
"{LOCAL_BRANCH_NAME}"
],
"options": [
{
"value": "--tags",
"default_active": false
},
{
"value": "--force",
"default_active": false
},
{
"value": "--set-upstream",
"default_active": false
}
]
},
{
"title": "Rename",
Expand Down
3 changes: 2 additions & 1 deletion web/src/views/store.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export commits_actions = (###* @type string[] ### hashes) => computed =>
export branch_actions = (###* @type Branch ### branch) => computed =>
parse_config_actions(config_branch_actions.value, [
['{BRANCH_NAME}', branch.id]
['{LOCAL_BRANCH_NAME}', branch.name]])
['{LOCAL_BRANCH_NAME}', branch.name]
['{REMOTE_NAME}', branch.remote_name or 'MISSING_REMOTE_NAME']])
export tag_actions = (###* @type string ### tag_name) => computed =>
parse_config_actions(config_tag_actions.value, [['{TAG_NAME}', tag_name]])
``###* @type {Ref<ConfigGitAction[]>} ###
Expand Down

0 comments on commit a8c5397

Please sign in to comment.