You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "waynexia (via GitHub)" <gi...@apache.org> on 2025/06/18 04:26:10 UTC
[PR] feat: implement --tree option for oli ls subcommand [opendal]
waynexia opened a new pull request, #6311:
URL: https://github.com/apache/opendal/pull/6311
Signed-off-by: Ruihang Xia <wa...@gmail.com># Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Related to https://github.com/apache/opendal/issues/422
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
Tree view is easier to read for deep folders
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Implement `oli ls --tree`/`oli ls -T` for listing with tree view. E.g.:
```
> oli ls -T ./src
.
├── bin/
│ └── oli.rs
├── commands/
│ ├── bench/
│ │ ├── mod.rs
│ │ ├── report.rs
│ │ └── suite.rs
│ ├── cat.rs
│ ├── cp.rs
│ ├── edit.rs
│ ├── ls.rs
│ ├── mod.rs
│ ├── mv.rs
│ ├── rm.rs
│ ├── stat.rs
│ └── tee.rs
├── config/
│ └── mod.rs
├── lib.rs
├── params/
│ ├── config.rs
│ └── mod.rs
└── utils/
```
# Are there any user-facing changes?
Yes, a new option
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking-changes` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: implement --tree option for oli ls subcommand [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #6311:
URL: https://github.com/apache/opendal/pull/6311#discussion_r2153658246
##########
bin/oli/tests/integration/ls.rs:
##########
@@ -44,3 +44,39 @@ async fn test_basic_ls() -> Result<()> {
Ok(())
}
+
+#[tokio::test]
+async fn test_ls_tree() -> Result<()> {
+ let dir = tempfile::tempdir()?;
+ fs::create_dir_all(dir.path().join("a/b"))?;
+
+ let file_root = dir.path().join("file_root");
+ let file_a = dir.path().join("a/file_a");
+ let file_b = dir.path().join("a/b/file_b");
+
+ let content = "hello";
+ fs::write(&file_root, content)?;
+ fs::write(&file_a, content)?;
+ fs::write(&file_b, content)?;
+
+ let current_dir = dir.path().to_string_lossy().to_string() + "/";
+ let t = oli()
+ .arg("ls")
+ .arg("--tree")
+ .arg(current_dir)
+ .assert()
+ .success();
+
+ let output = String::from_utf8(t.get_output().stdout.clone())?;
+ let expected = r#".
Review Comment:
Can we use the same snapshot testing method so that we don't have to update this manually?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: implement --tree option for oli ls subcommand [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #6311:
URL: https://github.com/apache/opendal/pull/6311
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org