From 483caf76fd36aeebc9d4ea2caf02e007271c5fd1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 5 Mar 2019 09:36:58 -0800 Subject: [PATCH] file type: add stringer This commit was moved from ipfs/interface-go-ipfs-core@4e99a8e9250040b9cfc9600641d138fca8ff01f9 This commit was moved from ipfs/boxo@ee697a3b097c25457cccf63c42ba03fadde9d4ef --- core/coreiface/unixfs.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index bdf08b5c3..d0e3ec572 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -30,6 +30,21 @@ const ( TSymlink ) +func (t FileType) String() string { + switch t { + case TUnknown: + return "unknown" + case TFile: + return "file" + case TDirectory: + return "directory" + case TSymlink: + return "symlink" + default: + return "" + } +} + // DirEntry is a directory entry returned by `Ls`. type DirEntry struct { Name string