Skip to content

Add ability to enter custom prompts before running custom commands #67

@idursun

Description

@idursun

I think that the only thing missing for me is being able to query the user for custom input to these custom commands. E.g., I would like to create a custom command to create a new bookmark for the current revision. The command should support bookmark set --revision $change_id $inputs.bookmark_name where $prompts is an array of user inputs specified in the custom command, and the .bookmark_name is the specific user input with the value inserted by the user when invoking the custom command through an interactive text field. Something like:

[custom_commands]
"new bookmark" = { 
  key = ["ctrl+b"], 
  args = ["bookmark", "set", "--revision", "$change_id", "$prompts.bookmark_name"],
  prompts = [ {id = bookmark_name, type = "text", title = "Name of the new bookmark"} ]
}

The prompts.type could be selecting from a menu (with filtering support), inputting a custom text, ...

Similarly to what Lazygit does with prompts:

  - key: 'n'
    context: 'localBranches'
    prompts:
      - type: 'menu'
        title: 'What kind of branch is it?'
        key: 'BranchType'
        options:
          - name: 'feature'
            description: 'a feature branch'
            value: 'feature'
          - name: 'hotfix'
            description: 'a hotfix branch'
            value: 'hotfix'
          - name: 'release'
            description: 'a release branch'
            value: 'release'
      - type: 'input'
        title: 'What is the new branch name?'
        key: 'BranchName'
        initialValue: ''
    command: "git flow {{.Form.BranchType}} start {{.Form.BranchName}}"
    loadingText: 'Creating branch'

Originally posted by @Adda0 in #63 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions