mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-27 00:30:27 +00:00
WIP
This commit is contained in:
parent
9527941501
commit
80f85b01d5
2 changed files with 17 additions and 3 deletions
|
@ -24,6 +24,10 @@ func NewValidateCommand() *cli.Command {
|
||||||
Aliases: []string{"c"},
|
Aliases: []string{"c"},
|
||||||
Usage: "Create a directory hierarchy spec",
|
Usage: "Create a directory hierarchy spec",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "C",
|
||||||
|
Usage: "Print ('dump') the specification provided by `-f` with full path names",
|
||||||
|
},
|
||||||
&cli.StringSliceFlag{
|
&cli.StringSliceFlag{
|
||||||
Name: "file",
|
Name: "file",
|
||||||
Aliases: []string{"f"},
|
Aliases: []string{"f"},
|
||||||
|
@ -78,7 +82,7 @@ func NewValidateCommand() *cli.Command {
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "result-format",
|
Name: "result-format",
|
||||||
Value: "bsd",
|
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)
|
excludes = append(excludes, mtree.ExcludeNonDirectories)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.Bool("C") && specDh != nil {
|
||||||
|
specDh.Entries
|
||||||
|
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// -u
|
// -u
|
||||||
// Failing early here. Processing is done below.
|
// Failing early here. Processing is done below.
|
||||||
if c.Bool("update-attributes") && c.String("tar") != "" {
|
if c.Bool("update-attributes") && c.String("tar") != "" {
|
||||||
|
|
|
@ -5,12 +5,15 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DirectoryHierarchy is the mapped structure for an mtree directory hierarchy
|
// DirectoryHierarchy is the mapped structure for an mtree directory hierarchy specification.
|
||||||
// spec
|
|
||||||
type DirectoryHierarchy struct {
|
type DirectoryHierarchy struct {
|
||||||
Entries []Entry
|
Entries []Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var DefaultDirectoryHierarchyFormatter
|
||||||
|
type DirectoryHierarchyFormatter interface {}
|
||||||
|
|
||||||
|
|
||||||
// WriteTo simplifies the output of the resulting hierarchy spec.
|
// WriteTo simplifies the output of the resulting hierarchy spec.
|
||||||
// Satisfies the `io.WriterTo` interface.
|
// Satisfies the `io.WriterTo` interface.
|
||||||
func (dh DirectoryHierarchy) WriteTo(w io.Writer) (n int64, err error) {
|
func (dh DirectoryHierarchy) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue