Skip to content

Commit

Permalink
Make sure filter objects ends with a /
Browse files Browse the repository at this point in the history
Fix condition check on tags in GH workflow
Run clippy and update Cargo.toml
  • Loading branch information
dormant-user committed Jul 29, 2024
1 parent d258827 commit 3647a4c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Package Name
id: get-package-info
run: |
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ description = "Service that creates object listing functionality for S3 buckets"
edition = "2021"
authors = ["Vignesh Rao"]
license = "MIT"
rust-version = "1.79.0"
documentation = "https://docs.rs/crate/lists3"
homepage = "https://github.com/thevickypedia/lists3"
repository = "https://github.com/thevickypedia/lists3"
keywords = ["s3-filebrowser", "bucket-listing"]
categories = ["filesystem", "embedded", "development-tools", "visualization"]
include = ["/src", "LICENSE"]
exclude = [".github", ".gitignore", "README.md"]

[[bin]]
name = "lists3"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ curl -o lists3-windows-amd64.zip -LH "Accept: application/octet-stream" "https:/
[https://crates.io/crates/lists3][crate]

### Cargo Docs - Official Runbook
[https://docs.rs/lists3/latest/lists3/][docs]
[https://docs.rs/crate/lists3][docs]

**Generator**
```shell
Expand Down Expand Up @@ -87,4 +87,4 @@ Licensed under the [MIT License][license]
[crate]: https://crates.io/crates/lists3
[gh-checks]: https://github.com/thevickypedia/lists3/actions/workflows/rust.yml
[crates-logo]: https://img.shields.io/crates/v/lists3.svg
[docs]: https://docs.rs/lists3/latest/
[docs]: https://docs.rs/crate/lists3
16 changes: 8 additions & 8 deletions src/squire/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn arguments(
("--proxy | -p", "Proxy server's path (eg: https://example.com/proxy)"),
("--style | -s", "Styling for the UI (eg: vanilla)"),
("--version | -v", "Get the package version.")
].iter().cloned().collect();
].to_vec();
let longest_key = options.iter().map(|(k, _)| k.len()).max().unwrap_or(0);
let pretext = "\n* ";
let choices: String = options.iter().map(|(k, v)| {
Expand All @@ -51,7 +51,7 @@ pub fn arguments(
"-b" | "--bucket" => {
i += 1; // Move to the next argument.
if i < args.len() {
bucket = args[i].clone();
bucket.clone_from(&args[i]);
} else {
eprintln!("--bucket requires a value.");
exit(1)
Expand All @@ -60,7 +60,7 @@ pub fn arguments(
"-r" | "--region" => {
i += 1; // Move to the next argument.
if i < args.len() {
region = args[i].clone();
region.clone_from(&args[i]);
} else {
eprintln!("--region requires a value.");
exit(1)
Expand All @@ -69,7 +69,7 @@ pub fn arguments(
"-f" | "--filter" => {
i += 1; // Move to the next argument.
if i < args.len() {
filter = args[i].clone();
filter.clone_from(&args[i]);
} else {
eprintln!("--filter requires a value.");
exit(1)
Expand All @@ -78,7 +78,7 @@ pub fn arguments(
"-i" | "--ignore" => {
i += 1; // Move to the next argument.
if i < args.len() {
ignore = args[i].clone();
ignore.clone_from(&args[i]);
} else {
eprintln!("--ignore requires a value.");
exit(1)
Expand All @@ -87,7 +87,7 @@ pub fn arguments(
"-o" | "--object" => {
i += 1; // Move to the next argument.
if i < args.len() {
object = args[i].clone();
object.clone_from(&args[i]);
} else {
eprintln!("--object requires a value.");
exit(1)
Expand All @@ -96,7 +96,7 @@ pub fn arguments(
"-p" | "--proxy" => {
i += 1; // Move to the next argument.
if i < args.len() {
proxy = args[i].clone();
proxy.clone_from(&args[i]);
} else {
eprintln!("--proxy requires a value.");
exit(1)
Expand All @@ -105,7 +105,7 @@ pub fn arguments(
"-s" | "--style" => {
i += 1; // Move to the next argument.
if i < args.len() {
style = args[i].clone();
style.clone_from(&args[i]);
} else {
eprintln!("--style requires a value.");
exit(1)
Expand Down
9 changes: 8 additions & 1 deletion src/squire/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ fn parse_vec(value: &str) -> Option<Vec<String>> {
return None;
}
match serde_json::from_str::<Vec<String>>(value) {
Ok(parsed) => Some(parsed),
Ok(mut parsed) => {
for elem in &mut parsed {
if !elem.ends_with('/') {
elem.push('/');
}
}
Some(parsed)
}
Err(err) => {
eprintln!("{:?}", err);
exit(1)
Expand Down

0 comments on commit 3647a4c

Please sign in to comment.