Skip to content

Commit

Permalink
fix: some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph0enixKM committed Mar 2, 2025
1 parent 39bf6d6 commit fa0b88f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/std/env.ab
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fun input_hidden(prompt: Text): Text {
///
/// "No" is the default choice, set default_yes to true for "Yes" as default choice.
pub fun input_confirm(prompt: Text, default_yes: Bool = false): Bool {
let choice_default = default_yes then " [\x1b[1mY/\x1b[0mn]" else " [y/\x1b[1mN\x1b[0m]"
let choice_default = default_yes then " [\\x1b[1mY/\\x1b[0mn]" else " [y/\\x1b[1mN\\x1b[0m]"
trust {
$ printf "\\x1b[1m{prompt}\\x1b[0m{choice_default}" $
$ read -s -n 1 $
Expand Down
24 changes: 12 additions & 12 deletions src/std/fs.ab
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ pub fun file_glob(path: Text): [Text]? {
pub fun file_extract(path: Text, target: Text): Null? {
if file_exists(path) {
if {
match_regex(path, "\.\(tar\.bz2\|tbz\|tbz2\)$"): $ tar xvjf "{path}" -C "{target}" $?
match_regex(path, "\.\(tar\.gz\|tgz\)$"): $ tar xzf "{path}" -C "{target}" $?
match_regex(path, "\.\(tar\.xz\|txz$\)$"): $ tar xJf "{path}" -C "{target}" $?
match_regex(path, "\.bz2$"): $ bunzip2 "{path}" $?
match_regex(path, "\.deb$"): $ dpkg-deb -xv "{path}" "{target}" $?
match_regex(path, "\.gz$"): $ gunzip "{path}" $?
match_regex(path, "\.rar$"): $ unrar x "{path}" "{target}" $?
match_regex(path, "\.rpm$"): $ rpm2cpio "{path}" | cpio -idm $?
match_regex(path, "\.tar$"): $ tar xf "{path}" -C "{target}" $?
match_regex(path, "\.xz$"): $ xz --decompress "{path}" $?
match_regex(path, "\.7z$"): $ 7z -y "{path}" -o "{target}" $?
match_regex(path, "\.\(zip\|war\|jar\)$"): $ unzip "{path}" -d "{target}" $?
match_regex(path, "\\.\\(tar\\.bz2\\|tbz\\|tbz2\\)$"): $ tar xvjf "{path}" -C "{target}" $?
match_regex(path, "\\.\\(tar\\.gz\\|tgz\\)$"): $ tar xzf "{path}" -C "{target}" $?
match_regex(path, "\\.\\(tar\\.xz\\|txz$\\)$"): $ tar xJf "{path}" -C "{target}" $?
match_regex(path, "\\.bz2$"): $ bunzip2 "{path}" $?
match_regex(path, "\\.deb$"): $ dpkg-deb -xv "{path}" "{target}" $?
match_regex(path, "\\.gz$"): $ gunzip "{path}" $?
match_regex(path, "\\.rar$"): $ unrar x "{path}" "{target}" $?
match_regex(path, "\\.rpm$"): $ rpm2cpio "{path}" | cpio -idm $?
match_regex(path, "\\.tar$"): $ tar xf "{path}" -C "{target}" $?
match_regex(path, "\\.xz$"): $ xz --decompress "{path}" $?
match_regex(path, "\\.7z$"): $ 7z -y "{path}" -o "{target}" $?
match_regex(path, "\\.\\(zip\\|war\\|jar\\)$"): $ unzip "{path}" -d "{target}" $?
else {
echo "Error: Unsupported file type"
fail 3
Expand Down
4 changes: 2 additions & 2 deletions src/tests/stdlib/env_escaped.ab
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import * from "std/env"
// Hello \\v Amber %%T

main {
echo escaped("Hello \v Amber %T")
}
echo escaped("Hello \\v Amber %T")
}

0 comments on commit fa0b88f

Please sign in to comment.