Skip to content

Commit

Permalink
Update regex lookahead to match when there are no characters
Browse files Browse the repository at this point in the history
  • Loading branch information
shinghim committed Dec 19, 2024
1 parent 9cb302e commit 23f75a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ main() {

# Print all public structs and enums.
structs_and_enums() {
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| )' "$file" | sed "s/^${crate_full_name}:://"
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://"
}

# Print all public structs and enums excluding error types.
structs_and_enums_no_err() {
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| )' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
}

# Print all public traits.
Expand Down

0 comments on commit 23f75a0

Please sign in to comment.