-
-
Notifications
You must be signed in to change notification settings - Fork 57
print output on the same line if output is a terminal #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
a38449e to
db8b53b
Compare
|
I think I've resolved the issue I tried to solve the wrong way in #44. |
michaelforney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think you could come up with a small abstraction for the status printing? Then the smart status printer could go into a separate file, and we avoid all the ifdefs.
Maybe something like statusinit(), statusprint(const char *status, const char *description), statusoutput(const char *out, size_t len), statusdone()?
Actually, now that I think about it, it might be simpler to just have a single function size_t termwidth(void). term-dumb.c could just return 0, and term-ansi.c could use the ioctl.
104f33a to
93a5a53
Compare
What would I do to have the build choose which of term-{dumb,ansi}.c to use? |
I'd just do TERM=dumb
OBJ=\
...
term-$(TERM).oOperating systems that want to enable smart status printing can just build with |
|
And should I add a header, or forward declare any functions from term-{dumb,ansi}.c in build.c? |
|
Yeah, a |
|
This will probably need at least some cleanup but I've moved the ifdefed stuff into separate files. |
michaelforney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is looking pretty good now.
6182891 to
7327254
Compare
can be manually enabled or disabled at build time by defining HAVE_TIOCGWINSZ in CFLAGS, otherwise automatically enabled on operating systems known to have the TIOCGWINSZ ioctl
|
Is there anything still blocking this? |
|
Honestly I think printing all output on the same line is a bad idea and (the lack of) this is the main reason why I use samu instead of ninja. Since ninja has no "whatif" tool which is the opposite of "commands", that is to print what would be built if a file was touched, the only way to do so is to touch the source file and do a |
|
This is a build-time option that defaults to being disabled, so I don't think that's really a problem |
can be manually enabled or disabled at build time by defining
HAVE_TIOCGWINSZ in CFLAGS, otherwise automatically disabled on
operating systems known to have the TIOCGWINSZ ioctl