manifoldco / promptui

Interactive prompt for command-line applications
https://www.manifold.co
BSD 3-Clause "New" or "Revised" License
6.03k stars 333 forks source link

[Feature Request] Select: Add ability to insert spaces/empty lines #230

Open SHU-red opened 7 months ago

SHU-red commented 7 months ago

I recently used this awesome project and love the way it handles. Due to the fact that i have to create a relatively large menu i would like to have the ability to create "space-lines" or "empty-lines" which can not be selected

Currently

   Commit: Add Commit 
  > Commit: Delete Commit
   Bucket: Copy to Clipboard 
   Bucket: Switch 
   Bucket: New 
   Bucket: Rename 
   Bucket: Delete
   Config: Switch
   Check In: Members
   Close

Target

   Commit: Add Commit 
  > Commit: Delete Commit

   Bucket: Copy to Clipboard 
   Bucket: Switch 
   Bucket: New 
   Bucket: Rename 
   Bucket: Delete

   Config: Switch

   Check In: Members

   Close

Implementation proposal

Maybe something like this? But my skills are absolutelty not good enough to tell you how it could be done 😅

    // Main Menu Options
    options := []option{
        {Topic: "Commit", Action: "Add Commit", Function: func() { cmm.Add() }, Description: "Add a new line to your bucket"},
        {Topic: "Commit", Action: "Delete Commit", Function: func() {}, Description: "Delete a single line from your commit"},
        {},
        {Topic: "Bucket", Action: "Copy to Clipboard", Function: func() {}, Description: "Copy Bucket to your clipboard"},
        {Topic: "Bucket", Action: "Switch", Function: func() {}, Description: "Switch to another Bucket"},
        {Topic: "Bucket", Action: "New", Function: func() {}, Description: "Create new Bucket"},
        {Topic: "Bucket", Action: "Rename", Function: func() {}, Description: "Rename a Bucket"},
        {Topic: "Bucket", Action: "Delete", Function: func() {}, Description: "Delete Bucket"},
        {},
        {Topic: "Config", Action: "Switch", Function: func() { configSwitch() }, Description: "Switch to another Config"},
    }