manifoldco / promptui

Interactive prompt for command-line applications

Home Page:https://www.manifold.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

SHU-red opened this issue · comments

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
  • It would be nice if the cursor just jumps past the empty line
  • Is there already a hack to achieve this?

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"},
	}