wizzomafizzo / mrext

Collection of extensions and utilities for the MiSTer system.
GNU General Public License v3.0
173 stars 11 forks source link

Search.sh print gamepath to stderr + NFCUI search integration #69

Closed sigboe closed 11 months ago

sigboe commented 11 months ago

I am opening a draft PR here, for this for code review. Currently this is set up to print the game path to stderr, because with my limited testing I was able to capture the output in bash like this

      gamePath="$(search.sh -print 2>&1 >"$(tty)")"

any critiques are welcome

nfcsearch

sigboe commented 11 months ago

@wizzomafizzo After deliberating a bit if this should print the path to stderr or do something else, I thought I'd check what other ncurses programs do. Where I believe dialog is the gold standard. And dialog does indeed write "computer readable" output to stderr, it still uses stderr for errors. So if you don't have any other suggestions to the implementation, this is ready to be merged.

excerpt from the dialog man page

Some widgets, e.g., checklist, will write text to dialog's output.  Normally that  is
the  standard  error,  but  there  are  options  for  changing  this:  “--output-fd”,
“--stderr” and “--stdout”.  No text is written if  the  Cancel  button  (or  ESC)  is
pressed; dialog exits immediately in that case.