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 Header predicates: islink, isfile, etc. #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/header.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
'6' => :fifo,
)

Base.isfile(hdr::Header) = hdr.type == :file
Base.islink(hdr::Header) = hdr.type == :symlink
Base.ischardev(hdr::Header) = hdr.type == :chardev
Base.isblockdev(hdr::Header) = hdr.type == :blockdev
Base.isdir(hdr::Header) = hdr.type == :directory
Base.isfifo(hdr::Header) = hdr.type == :fifo

Check warning on line 73 in src/header.jl

View check run for this annotation

Codecov / codecov/patch

src/header.jl#L68-L73

Added lines #L68 - L73 were not covered by tests

function to_symbolic_type(type::Char)
for (t, s) in TYPE_SYMBOLS
type == t && return s
Expand Down