Skip to content
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

Undocumented stdout behaviour #43

Open
Kresimir235 opened this issue Feb 7, 2021 · 1 comment
Open

Undocumented stdout behaviour #43

Kresimir235 opened this issue Feb 7, 2021 · 1 comment

Comments

@Kresimir235
Copy link

Kresimir235 commented Feb 7, 2021

Printed output on the screen does not match the output sent to stdout. For example:

$ diskus
23.24 MB (23,240,704 bytes)
$ diskus | cat
23240704

Now, I try to understand the purpose of this: when piping to an external program it is often useful to have the raw number, without any formatting. That's all well and good, but it is unexpected as it does not comply with conventions used by other CLI tools. Also, there is no mention of it in the documentation. Additionally, there should be a simple way to send the entire, formatted output to stdout. Typically, unless the output is dynamic (like text progress bars), what one sees on the screen should be the stdout, and if there is a need for changing the format of the output, that should be handled by the command options.

@sharkdp
Copy link
Owner

sharkdp commented Feb 7, 2021

Now, I try to understand the purpose of this: when piping to an external program it is often useful to have the raw number, without any formatting. That's all well and good, but it is unexpected as it does not comply with conventions used by other CLI tools.

I think there are a few examples where programs do something similar. ls changes its default format from a space-saving format to a line-oriented one:

▶ ls
bar  baz  foo

▶ ls | cat            
bar
baz
foo

ripgrep also does something similar and changes its output format to something that is more suited for pipeline usage.

Also, there is no mention of it in the documentation.

Agreed, that should be fixed.

Additionally, there should be a simple way to send the entire, formatted output to stdout.

Also agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants