2016-12-01 02:42:42 +00:00
|
|
|
// Copyright © 2016 Zellyn Hunter <zellyn@gmail.com>
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2021-07-12 21:02:11 +00:00
|
|
|
"text/tabwriter"
|
2016-12-01 02:42:42 +00:00
|
|
|
|
2021-06-26 02:33:11 +00:00
|
|
|
"github.com/zellyn/diskii/types"
|
2016-12-01 02:42:42 +00:00
|
|
|
)
|
|
|
|
|
2021-07-12 21:02:11 +00:00
|
|
|
type FiletypesCmd struct {
|
|
|
|
All bool `kong:"help='Display all types, including SOS types and reserved ranges.'"`
|
2016-12-01 02:42:42 +00:00
|
|
|
}
|
|
|
|
|
2021-07-12 21:02:11 +00:00
|
|
|
func (f *FiletypesCmd) Run(globals *types.Globals) error {
|
|
|
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
|
|
|
|
fmt.Fprintln(w, "Description\tName\tThree-letter Name\tOne-letter Name")
|
|
|
|
fmt.Fprintln(w, "-----------\t----\t-----------------\t---------------")
|
|
|
|
for _, typ := range types.FiletypeInfos(f.All) {
|
|
|
|
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", typ.Desc, typ.Name, typ.ThreeLetter, typ.OneLetter)
|
2016-12-01 02:42:42 +00:00
|
|
|
}
|
2021-07-12 21:02:11 +00:00
|
|
|
w.Flush()
|
2016-12-01 02:42:42 +00:00
|
|
|
return nil
|
|
|
|
}
|