Skip to content

Commit

Permalink
fix "Task names with inline comment are not detected" #21 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyu08 authored Mar 30, 2023
1 parent 945730c commit e7cdda1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fzf-make"
version = "0.3.0"
version = "0.4.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo-test:
@echo good

test :
test : # run test
echo "test"

run:
Expand Down
14 changes: 7 additions & 7 deletions src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn contents_to_commands(contents: String) -> Result<Vec<String>, &'static str> {
}

fn line_to_command(line: String) -> Option<String> {
let regex = Regex::new(r"^[^.#\s].+:$").unwrap();
let regex = Regex::new(r"^[^.#\s\t].+:.*$").unwrap();
regex.find(line.as_str()).and_then(|m| {
Some(
m.as_str()
Expand Down Expand Up @@ -98,7 +98,7 @@ mod test {
let cases = vec![
Case {
contents: "\
.PHONY: run build check
.PHONY: run build check test
run:
@cargo run
Expand All @@ -109,9 +109,13 @@ build:
check:
@cargo check
test: # run test
@cargo test
echo:
@echo good",
expect: Ok(vec!["run", "build", "check", "echo"]),
expect: Ok(vec!["run", "build", "check", "test", "echo"]),
},
Case {
contents: "\
Expand Down Expand Up @@ -180,10 +184,6 @@ build:
contents: ".DEFAULT:",
expect: None,
},
Case {
contents: "https://example.com",
expect: None,
},
Case {
contents: "# run:",
expect: None,
Expand Down

0 comments on commit e7cdda1

Please sign in to comment.