CodeIgniter Forums
CLI No Newline - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: CLI No Newline (/showthread.php?tid=73220)



CLI No Newline - MGatner - 04-01-2019

I'd love a way to suppress the newline character from CLI::write, so you can do things like:
Generating new widget...

then in a bit:
Generating new widget... Done!

CLI:write is already pretty darn loaded with parameters, so maybe a new command?


RE: CLI No Newline - kilishan - 04-01-2019

You can use CLI::color() to do that.


RE: CLI No Newline - MGatner - 04-02-2019

... genius.


RE: CLI No Newline - MGatner - 04-02-2019

`CLI:color()` doesn't appear to be doing anything on its own:

PHP Code:
CLI::write("Sample from `write` command");
CLI::color("Sample from `color` command"'black');
CLI::write("Wrapping up"); 

Results in:

Sample from `write` command
Wrapping up


RE: CLI No Newline - kilishan - 04-02-2019

Doh! You're right, it doesn't. Not sure why I was remembering that.

Anyway - I just pushed up a new command that does just what you're looking for: print().


RE: CLI No Newline - MGatner - 04-03-2019

Woohoo! Custom methods, on demand! Boy, do I have a list for you Smile
You're not imagining, the docs still state: "you can use the color() method to make a string fragment that can be used in the same way, except that it will not force an EOL after printing. This allows you to create multiple outputs on the same row". I can PR that out tomorrow if nobody has gotten to it yet.