Commit aa7a8776 authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi unixfs: stdin-name option

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent cb84af4b
......@@ -32,8 +32,9 @@ type UnixfsAddSettings struct {
OnlyHash bool
Local bool
Wrap bool
Hidden bool
Wrap bool
Hidden bool
StdinName string
}
type UnixfsAddOption func(*UnixfsAddSettings) error
......@@ -55,8 +56,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
OnlyHash: false,
Local: false,
Wrap: false,
Hidden: false,
Wrap: false,
Hidden: false,
StdinName: "",
}
for _, opt := range opts {
......@@ -225,3 +227,12 @@ func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption {
return nil
}
}
// StdinName is the name set for files which don specify FilePath as
// os.Stdin.Name()
func (unixfsOpts) StdinName(name string) UnixfsAddOption {
return func(settings *UnixfsAddSettings) error {
settings.StdinName = name
return nil
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment