1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-07-26 00:00:29 +00:00
This commit is contained in:
Vincent Batts 2023-11-29 20:28:12 -05:00
parent 9527941501
commit 80f85b01d5
2 changed files with 17 additions and 3 deletions

View file

@ -24,6 +24,10 @@ func NewValidateCommand() *cli.Command {
Aliases: []string{"c"},
Usage: "Create a directory hierarchy spec",
},
&cli.BoolFlag{
Name: "C",
Usage: "Print ('dump') the specification provided by `-f` with full path names",
},
&cli.StringSliceFlag{
Name: "file",
Aliases: []string{"f"},
@ -78,7 +82,7 @@ func NewValidateCommand() *cli.Command {
&cli.StringFlag{
Name: "result-format",
Value: "bsd",
Usage: "output the validation results using the given format (bsd, json, path)",
Usage: "output the validation results/errors using the given format (bsd, json, path)",
},
},
}
@ -245,6 +249,13 @@ func validateAction(c *cli.Context) error {
excludes = append(excludes, mtree.ExcludeNonDirectories)
}
if c.Bool("C") && specDh != nil {
specDh.Entries
return nil
}
// -u
// Failing early here. Processing is done below.
if c.Bool("update-attributes") && c.String("tar") != "" {

View file

@ -5,12 +5,15 @@ import (
"sort"
)
// DirectoryHierarchy is the mapped structure for an mtree directory hierarchy
// spec
// DirectoryHierarchy is the mapped structure for an mtree directory hierarchy specification.
type DirectoryHierarchy struct {
Entries []Entry
}
var DefaultDirectoryHierarchyFormatter
type DirectoryHierarchyFormatter interface {}
// WriteTo simplifies the output of the resulting hierarchy spec.
// Satisfies the `io.WriterTo` interface.
func (dh DirectoryHierarchy) WriteTo(w io.Writer) (n int64, err error) {