From 97a728e72256850fd1042c929500465b06153c1e Mon Sep 17 00:00:00 2001 From: figsoda Date: Sat, 13 Nov 2021 11:40:29 -0500 Subject: [PATCH 1/3] improve issue templates --- .github/ISSUE_TEMPLATE/bug-report.md | 12 ------ .github/ISSUE_TEMPLATE/bug-report.yml | 40 +++++++++++++++++++ .../documentation-improvement.md | 6 +-- .github/ISSUE_TEMPLATE/feature-request.md | 6 +++ .github/ISSUE_TEMPLATE/question.md | 6 +++ 5 files changed, 53 insertions(+), 17 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 .github/ISSUE_TEMPLATE/question.md diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index 1df76de..0000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Bug Report -about: Any Ouch bug -title: '_[BUG]_ ' -labels: bug -assignees: '' - ---- - -Thanks for filling a bug report! - -Don't forget to add the `ouch` version for which this error occurred. diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..9c5e36d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,40 @@ +name: Bug Report +description: Report a ouch bug +labels: [bug] +body: + - type: markdown + attributes: + value: Thanks for filling a bug report! + + - type: input + id: version + attributes: + label: Version + description: Version of ouch you encountered this error, or git commit hash if you are not using a versioned release + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description + validations: + required: true + + - type: textarea + id: current + attributes: + label: Current Behavior + + - type: textarea + id: expected + attributes: + label: Expected Behavior + + - type: textarea + id: info + attributes: + label: Additional Information + description: > + Additional information that might help us debug this issue, + such as the operating system you are using or the files you tried to archive/extract diff --git a/.github/ISSUE_TEMPLATE/documentation-improvement.md b/.github/ISSUE_TEMPLATE/documentation-improvement.md index 9c0e616..b44ae39 100644 --- a/.github/ISSUE_TEMPLATE/documentation-improvement.md +++ b/.github/ISSUE_TEMPLATE/documentation-improvement.md @@ -1,10 +1,6 @@ --- name: Documentation Improvement -about: Improvements in repository markdown or code docs -title: '_[DOCS]_ ' +about: Improvements in repository markdown or code documentations labels: documentation -assignees: '' --- - - diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..8aa482b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,6 @@ +--- +name: Feature / Enhancement +about: Features or change you want to see in ouch +labels: enhancement + +--- diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..846e036 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,6 @@ +--- +name: Question +about: Ask a question about ouch. You can also ask questions in discussions: https://github.com/ouch-org/ouch/discussions +labels: question + +--- From c1092a51da1a0c4ed5703c5045cce0de680a68a8 Mon Sep 17 00:00:00 2001 From: figsoda Date: Sat, 13 Nov 2021 19:16:58 -0500 Subject: [PATCH 2/3] fix question template --- .github/ISSUE_TEMPLATE/question.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 846e036..dd1a7aa 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,6 +1,6 @@ --- name: Question -about: Ask a question about ouch. You can also ask questions in discussions: https://github.com/ouch-org/ouch/discussions +about: "Ask a question about ouch. You can also ask questions in discussions: https://github.com/ouch-org/ouch/discussions" labels: question --- From afc8367230f143b6c343852290bcb94325426dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Rodrigues=20Miguel?= Date: Sun, 14 Nov 2021 01:53:59 -0300 Subject: [PATCH 3/3] Simplify (optimize?) several file inferring functions --- src/utils/fs.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/fs.rs b/src/utils/fs.rs index f1d14ab..d4c87eb 100644 --- a/src/utils/fs.rs +++ b/src/utils/fs.rs @@ -70,22 +70,22 @@ pub fn try_infer_extension(path: &Path) -> Option { buf.len() > 261 && buf[257..=261] == [0x75, 0x73, 0x74, 0x61, 0x72] } fn is_gz(buf: &[u8]) -> bool { - buf.len() > 2 && buf[..=2] == [0x1F, 0x8B, 0x8] + buf.starts_with(&[0x1F, 0x8B, 0x8]) } fn is_bz2(buf: &[u8]) -> bool { - buf.len() > 2 && buf[..=2] == [0x42, 0x5A, 0x68] + buf.starts_with(&[0x42, 0x5A, 0x68]) } fn is_xz(buf: &[u8]) -> bool { - buf.len() > 5 && buf[..=5] == [0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00] + buf.starts_with(&[0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00]) } fn is_lz(buf: &[u8]) -> bool { - buf.len() > 3 && buf[..=3] == [0x4C, 0x5A, 0x49, 0x50] + buf.starts_with(&[0x4C, 0x5A, 0x49, 0x50]) } fn is_lz4(buf: &[u8]) -> bool { - buf.len() > 3 && buf[..=3] == [0x04, 0x22, 0x4D, 0x18] + buf.starts_with(&[0x04, 0x22, 0x4D, 0x18]) } fn is_zst(buf: &[u8]) -> bool { - buf.len() > 3 && buf[..=3] == [0x28, 0xB5, 0x2F, 0xFD] + buf.starts_with(&[0x28, 0xB5, 0x2F, 0xFD]) } let buf = {