Open gilcot opened 7 years ago
I like this idea a lot.
I'm not sure how I'd implement this in a portable cross-platform way (or if it's even possible), but the idea intruiges me.
Let me mull it over for a bit.
Hello,
Thanks for the input.
There're two ideas here (maybe I should have opend different issues? but the're all related to output displaying)
Regards.
Hello again,
What I think I'm going to do for the display of data is to have my program check:
If it sees that it's being output to a tty like stdout, output stays as-is. If it detects that its output is being piped to something else, it will output data in csv format instead of formatting it as an ascii table.
thoughts?
Hello,
You made a very good suggestion: people do like having nice formating (like now) and often have a wider screen/terminal (mine is sixty columns, what make some long lines mess.) It's a good agreement if you that's possible (I didn't know it's possible to detect if the output is being piped or being redirected)
Thanks.
Hello,
While in
phpipam
shell like, It's better to display theget
command results via the system pager... (see similare discussion with use of Popen or pydoc with fallback to print etc.) It's usefull when there are many results (often 2 or 3 pages) but also for people that don't want folding. For system page, it's better to use the environment variable$PAGER
(some one may set itvi
, some other toless -S
, some may preferpg -f
or justmore -f
witch is always the-facto fallback when the environnement variable is emptyWhile using a direct call, e.g.
phpipam -u <user> -p <pass> get all <keyword>
, It's better not have column aligned outputs but fields separed by tabulation (or another separator if defined in configuration file) This makes it easy to pipe to filters likecut
and so.Thanks.