Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom commands prompt type with multiline support #3476

Open
Djedouas opened this issue Apr 5, 2024 · 10 comments · May be fixed by #3548
Open

Custom commands prompt type with multiline support #3476

Djedouas opened this issue Apr 5, 2024 · 10 comments · May be fixed by #3548
Labels
enhancement New feature or request

Comments

@Djedouas
Copy link

Djedouas commented Apr 5, 2024

Hi,

I would like to adapt the custom command with conventional commit templates to add a step for writing a multiline description.

To do this, I am looking for a prompt type that could be used to input text on more than one line, like we have when committing (i.e. the prompt below the commit title).

image

Thanks

@Djedouas Djedouas added the enhancement New feature or request label Apr 5, 2024
@mark2185
Copy link
Collaborator

mark2185 commented Apr 9, 2024

Are you thinking about the Custom command popup when you press : or the predefined custom commands you have in your config.yml?

Predefined custom commands do support multiple lines, you just need to write them like this (>-):

- key: 'D'
  command: >-
    echo "line1" &&
    echo "line2"
  context: 'localBranches'
  stream: true

I don't think we document it anywhere, though 🤔

@Djedouas
Copy link
Author

Djedouas commented Apr 9, 2024

Thanks for your answer :)

This is useful to know, but I think I might have been misunderstood...

I am talking about the predefined custom commands I can configure in config.yaml. At least I need to pop up a prompt in which the user can write multiple lines of text. Ideally, I need to pop up a prompt exactly like the standard commit prompt which is in two parts (a one-line box, and a multi -line box below), and getting the text as a result keys from this prompt.

@mark2185
Copy link
Collaborator

mark2185 commented Apr 9, 2024

Ah, now I get it.

Currently we don't have something like that, but (at a glance) it shouldn't be too difficult to implement.

Would you maybe be willing to investigate this? (you can say no :) )

@Djedouas
Copy link
Author

Djedouas commented Apr 9, 2024

cool :)

I have to say no, learning go is not checked on my wish list yet... ;-)

Overall I think that a generic prompt supporting multi-line text could be more suitable as a custom command prompt type, rather than a mixed one-line / multi-line prompt which is more specific.

@mark2185
Copy link
Collaborator

mark2185 commented Apr 9, 2024

Overall I think that a generic prompt supporting multi-line text could be more suitable as a custom command prompt type, rather than a mixed one-line / multi-line prompt which is more specific.

Agreed, but the benefit of the mixed one is the confirmation vs newline problem is solved.
We use Enter for both, but when in the single-line prompt it means "Confirm", while in the mult-line prompt it means \n.
If we had only the multiline, then we'd have to figure out how to actually confirm the input or how to add newlines and sacrifice some other key.

@Djedouas
Copy link
Author

Djedouas commented Apr 9, 2024

Ah yes right! 😄

And I must say that it's a very good mechanism, it was very intuitive for me the first time I used it.

@yongjoon-km yongjoon-km linked a pull request May 5, 2024 that will close this issue
6 tasks
@yongjoon-km
Copy link

Hi, I created PR for a multiline supported prompt and named it textbox
Please review this. Thank you 😄

@Djedouas
Copy link
Author

Djedouas commented May 13, 2024

Thanks @yongjoon-km , it works :)

Regarding @mark2185 comment, I see you chose <a-enter> as a key combination to confirm the multi-line textbox.

Works great for me, but could it be a problem if the combination is already associated somewhere in lazygit or system wide?

@yongjoon-km
Copy link

yongjoon-km commented May 13, 2024

Thanks @yongjoon-km , it works :)

Regarding @mark2185 comment, I see you chose <a-enter> as a key combination to confirm the multi-line textbox.

Works great for me, but could it be a problem if the combination is already associated somewhere in lazygit or system wide?

Hi @Djedouas, I chose confirmInEditor keybinding in lazygit which is default <a-enter>.
If <a-enter> is being used in system wide, user should map another key as confirmInEditor.
Note that this keybinding is also used in the commit description prompt.
Or <a-enter> might be used by another keybinding in lazygit, then proper keybinding must be set for confirmInEditor keybinding.
Also, the description of textbox prompt on the top right corner is applied by keybinding's key name.

@Djedouas
Copy link
Author

Great that sounds perfect 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants