detect columns: intruduce a --guess flag, remove --legacy (#12333)

# Description
This pr is addressing feedback from
https://github.com/nushell/nushell/pull/12277#issuecomment-2027246752

Currently I think it's fine to replace `--legacy` flag with `--guess`
one. Only use `guess_width` algorithm if `--guess` is provided.

# User-Facing Changes
So it won't be a breaking change to previous version.
This commit is contained in:
Wind
2024-03-30 08:59:57 +08:00
committed by GitHub
parent cf923fc44c
commit ff2aba7ae3
2 changed files with 19 additions and 15 deletions

View File

@ -11,14 +11,14 @@ fn detect_columns_with_legacy() {
for case in cases.into_iter() {
let out = nu!(
cwd: dirs.test(),
"({} | detect columns --legacy) == {}",
"({} | detect columns) == {}",
case.0,
case.1
);
assert_eq!(
out.out, "true",
"({} | detect columns --legacy) == {}",
"({} | detect columns) == {}",
case.0, case.1
);
}
@ -49,7 +49,7 @@ fn detect_columns_with_legacy_and_flag_c() {
for case in cases.into_iter() {
let out = nu!(
cwd: dirs.test(),
"({} | detect columns --legacy --combine-columns {}) == {}",
"({} | detect columns --combine-columns {}) == {}",
case.0,
case.2,
case.1,
@ -57,7 +57,7 @@ fn detect_columns_with_legacy_and_flag_c() {
assert_eq!(
out.out, "true",
"({} | detect columns --legacy --combine-columns {}) == {}",
"({} | detect columns --combine-columns {}) == {}",
case.0, case.2, case.1
);
}