Skip to content

Commit

Permalink
fix: update document against target format check and add hints (#5361)
Browse files Browse the repository at this point in the history
  • Loading branch information
waynexia authored Dec 4, 2024
1 parent dbae329 commit 6306acf
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions bin/oli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ For different services, you could find the configuration keys in the correspondi
### Example: use `oli` to upload file to AWS S3

```text
$ oli cp ./update-ecs-loadbalancer.json s3://update-ecs-loadbalancer.json
$ oli ls s3://
$ oli cp ./update-ecs-loadbalancer.json s3:/update-ecs-loadbalancer.json
$ oli ls s3:/
fleet.png
update-ecs-loadbalancer.json
```

### Example: use `oli` copy file from S3 to R2

```text
$ oli cp s3://fleet.png r2://fleet.png
$ oli ls r2://
$ oli cp s3:/fleet.png r2:/fleet.png
$ oli ls r2:/
fleet.png
```

Expand Down
1 change: 1 addition & 0 deletions bin/oli/src/commands/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::params::config::ConfigParams;
pub struct CatCmd {
#[command(flatten)]
pub config_params: ConfigParams,
/// In the form of `<profile>:/<path>`.
#[arg()]
pub target: String,
}
Expand Down
2 changes: 2 additions & 0 deletions bin/oli/src/commands/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ const PROGRESS_CHARS: &str = "#>-";
pub struct CopyCmd {
#[command(flatten)]
pub config_params: ConfigParams,
/// In the form of `<profile>:/<path>`.
#[arg()]
pub source: String,
/// In the form of `<profile>:/<path>`.
#[arg()]
pub destination: String,
/// Copy objects recursively.
Expand Down
1 change: 1 addition & 0 deletions bin/oli/src/commands/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::params::config::ConfigParams;
pub struct LsCmd {
#[command(flatten)]
pub config_params: ConfigParams,
/// In the form of `<profile>:/<path>`.
#[arg()]
pub target: String,
/// List objects recursively.
Expand Down
1 change: 1 addition & 0 deletions bin/oli/src/commands/rm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::params::config::ConfigParams;
pub struct RmCmd {
#[command(flatten)]
pub config_params: ConfigParams,
/// In the form of `<profile>:/<path>`.
#[arg()]
pub target: String,
/// Remove objects recursively.
Expand Down
1 change: 1 addition & 0 deletions bin/oli/src/commands/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::params::config::ConfigParams;
pub struct StatCmd {
#[command(flatten)]
pub config_params: ConfigParams,
/// In the form of `<profile>:/<path>`.
#[arg()]
pub target: String,
}
Expand Down
4 changes: 2 additions & 2 deletions bin/oli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl Config {

let location = Url::parse(s)?;
if location.has_host() {
Err(anyhow!("Host part in a location is not supported."))?;
Err(anyhow!("Host part in a location is not supported. Hint: are you typing `://` instead of `:/`?"))?;
}

let profile_name = location.scheme();
Expand Down Expand Up @@ -338,7 +338,7 @@ enable_virtual_host_style = "on"
let uri = "mys3://foo/1.txt";
let expected_msg = "Host part in a location is not supported.";
match cfg.parse_location(uri) {
Err(e) if e.to_string() == expected_msg => Ok(()),
Err(e) if e.to_string().contains(expected_msg) => Ok(()),
_ => Err(anyhow!(
"Getting an message \"{}\" is expected when parsing {}.",
expected_msg,
Expand Down

0 comments on commit 6306acf

Please sign in to comment.