Repository navigation
Conversation
13c6b5d to
b7dea6f
Compare
|
GNU testsuite comparison: |
Merging this PR will improve performance by 9.99%1 warning, 1 note
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
738e4bd to
4e9570c
Compare
7808763 to
1b977c0
Compare
|
@RenjiSann the dependency has been merged in the meantime :) |
1b977c0 to
79d38b1
Compare
Yep, but the GNU test isn't fixed just yet, I'll investigate |
79d38b1 to
8ca4cfa
Compare
2ff7ce1 to
78e92ed
Compare
This comment was marked as outdated.
This comment was marked as outdated.
78e92ed to
b48a514
Compare
3475f9c to
a1f396e
Compare
|
@cakebaker should be ready to review ^^ |
a066490 to
f056eda
Compare
f056eda to
870fb8b
Compare
870fb8b to
1e9c62a
Compare
| // no program provided, so just dump all env vars to stdout | ||
| print_all_env_vars(opts.line_ending)?; | ||
| // `encoding` is irrelevant when `quoting_style` is None | ||
| print_all_env_vars(opts.line_ending, None, UEncoding::Ascii)?; |
There was a problem hiding this comment.
env now needs the quoting-style feature just to pass None here
could we keep a plain print_all_env_vars and not gate it?
There was a problem hiding this comment.
Duplicated the print_all_env_vars to a "quoting-style"-gated print_all_env_vars_quoted variant, that takes the quoting_style and encoding arguments.
| printenv-usage = printenv [OPTION]... [VARIABLE]... | ||
|
|
||
| printenv-help-null = end each output line with 0 byte rather than newline | ||
| printenv-help-quoting-style = set quoting style |
There was a problem hiding this comment.
could you please list the accepted values in the help, like ls does?
|
|
||
| let maybe_quoting_style = matches | ||
| .get_one::<String>(OPT_QUOTING_STYLE) | ||
| .and_then(QuotingStyle::parse) |
There was a problem hiding this comment.
an invalid --quoting-style=foo is silently ignored here, could we reject it with a value_parser like ls does?
please add a test for it too
| .and_then(QuotingStyle::parse) | ||
| .or_else(|| { | ||
| std::io::stdout() | ||
| .is_terminal() // quoting style from env var is only used in TTY |
There was a problem hiding this comment.
why only on a tty? stat and ls use QUOTING_STYLE whatever stdout is
There was a problem hiding this comment.
Only following GNU behavior here
| pub fn print_all_env_vars<T: fmt::Display>(line_ending: T) -> io::Result<()> { | ||
| #[cfg(feature = "quoting-style")] | ||
| pub fn print_all_env_vars<T: fmt::Display>( | ||
| line_ending: T, |
There was a problem hiding this comment.
why gate the whole function behind quoting-style? only the escaping needs it
There was a problem hiding this comment.
As mentioned above, created a specific print_all_env_vars_quoted
1291986 to
9907277
Compare
9907277 to
7369440
Compare
|
Binary size comparison: |
|
|
Depends on #14856
Make
printenvcheck forQUOTING_STYLEand adapt its output accordinglyShould make
tests/misc/printenv.shpassDIFF