Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wildcard support for Windows #12

Open
ericcornelissen opened this issue Apr 28, 2023 · 0 comments
Open

Add wildcard support for Windows #12

ericcornelissen opened this issue Apr 28, 2023 · 0 comments
Labels
enhancement New feature or request os:windows

Comments

@ericcornelissen
Copy link
Owner

Feature Request

Summary

The wild crate can be used to add support for wildcards ("*foo*, file.???, *.log.[0-9], etc.") to Rust-based CLIs on systems that don't natively. This software could benefit from this greatly as it would make removing multiple related files simpler on those systems that don't have native wildcard support.

Suggested Test

// tests/wildcard_test.rs

//! Test suite focused on testing wildcard support on non-Unix systems.

pub mod common;

use crate::common::{has_exactly_lines, rm_out, with_test_dir, TestResult};

use assert_fs::prelude::*;
use predicates::prelude::*;

#[test]
fn wildcard() -> TestResult {
    let filename1 = "file-a";
    let filename2 = "file-b";

    with_test_dir(|mut cmd, test_dir| {
        let file1 = test_dir.child(filename1);
        let file2 = test_dir.child(filename2);

        cmd.arg("file-*")
            .assert()
            .success()
            .stdout(has_exactly_lines!(
                rm_out::dry_removed(filename1),
                rm_out::dry_removed(filename2);
                rm_out::newline(),
                rm_out::dry_conclusion(2, 0),
            ))
            .stderr("");
        file1.assert(predicate::path::exists());
        file2.assert(predicate::path::exists());

        cmd.arg("--force")
            .assert()
            .success()
            .stdout(has_exactly_lines!(
                rm_out::removed(filename1),
                rm_out::removed(filename2);
                rm_out::newline(),
                rm_out::conclusion(2, 0),
            ))
            .stderr("");
        file1.assert(predicate::path::exists());
        file2.assert(predicate::path::exists());

        Ok(())
    })
}
@ericcornelissen ericcornelissen added enhancement New feature or request os:windows labels Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request os:windows
Projects
None yet
Development

No branches or pull requests

1 participant