metal3d / bashsimplecurses

A simple curses library made in bash to draw terminal interfaces
BSD 3-Clause "New" or "Revised" License
921 stars 115 forks source link

Error "Option 1 does not exist" in README example #50

Closed mrsarm closed 1 year ago

mrsarm commented 3 years ago

If I clone this repo, and create a file e.g. sample.sh in the same folder, and add a content almost identical to the README sample on it:

#!/bin/bash
source ./simple_curses.sh

main (){
    #your code here, you can add some windows, text...
    window "title" "color"
    append "Text..."
    endwin
}

main_loop 1

Then adding execution permission (chmod +x simple_curses.sh) and executing it I got this:

$ ./sample.sh 
Option 1 does not exist

Removing the 1 argument to the main_loop call in the last line of the script solves the issue.

Is the example in the README wrong/outdated ?

leephillips commented 2 years ago

There was an undocumented change a while ago. Look at the bashbar.sh example, or just replace the main_loop call in your script with

main_loop -t 1 "$@"

(Yes, the README is outdated and incorrect.)

metal3d commented 2 years ago

Is this still a bug ?

leephillips commented 2 years ago

I have no idea.