Commit 130c08c3 authored by Jakub Sztandera's avatar Jakub Sztandera

Make format logic look much better

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent 94f1922d
......@@ -135,24 +135,19 @@ func statGetFormatOptions(req cmds.Request) (string, error) {
hash, _, _ := req.Option("hash").Bool()
size, _, _ := req.Option("size").Bool()
formatSpecified := req.Option("format").Found()
format, found, _ := req.Option("format").String()
if moreThanOne(hash, size, formatSpecified) {
if moreThanOne(hash, size, found) {
return "", formatError
}
format := ""
if hash {
format = "<hash>"
return "<hash>", nil
} else if size {
return "<cumulsize>", nil
} else {
return format, nil
}
if size {
format = "<cumulsize>"
}
if len(format) == 0 {
format, _, _ = req.Option("format").String()
}
return format, nil
}
func statNode(ds dag.DAGService, fsn mfs.FSNode) (*Object, error) {
......
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