This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new f17dc099e feat(oli): oli stat should show path as specified by users 
(#2842)
f17dc099e is described below

commit f17dc099e72520630c41750b011fa3b18423d647
Author: Kousuke Saruta <[email protected]>
AuthorDate: Thu Aug 10 17:06:03 2023 +0900

    feat(oli): oli stat should show path as specified by users (#2842)
    
    Show path as specified by user.
---
 bin/oli/src/commands/stat.rs | 2 +-
 bin/oli/tests/stat.rs        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/oli/src/commands/stat.rs b/bin/oli/src/commands/stat.rs
index 8d7545314..d4efacae4 100644
--- a/bin/oli/src/commands/stat.rs
+++ b/bin/oli/src/commands/stat.rs
@@ -37,7 +37,7 @@ pub async fn main(args: &ArgMatches) -> Result<()> {
     let (op, path) = cfg.parse_location(target)?;
 
     let meta = op.stat(&path).await?;
-    println!("path: {path}");
+    println!("path: {target}");
     let size = meta.content_length();
     println!("size: {size}");
     if let Some(etag) = meta.etag() {
diff --git a/bin/oli/tests/stat.rs b/bin/oli/tests/stat.rs
index aa4da5795..2e6c9d1d1 100644
--- a/bin/oli/tests/stat.rs
+++ b/bin/oli/tests/stat.rs
@@ -36,7 +36,7 @@ async fn test_basic_stat() -> Result<()> {
 
     let output_stdout = String::from_utf8(output)?;
     let mut expected_path = "path: ".to_string();
-    expected_path.push_str(&dst_path.to_string_lossy()[1..]);
+    expected_path.push_str(&dst_path.to_string_lossy());
     assert!(output_stdout.contains(&expected_path));
     assert!(output_stdout.contains("size: 5"));
     assert!(output_stdout.contains("type: file"));

Reply via email to