@@ -39,22 +39,23 @@ import (
39
39
)
40
40
41
41
var (
42
- awsProfile string
43
- awsRegion string
44
- endpointURL string
45
- local bool
46
- noColor bool
47
- mfa bool
48
- level int
49
- fullPath bool
50
- fileName string
51
- size bool
52
- humanReadable bool
53
- dateTime bool
54
- username bool
55
- directoryOnly bool
56
- pattern string
42
+ awsProfile string
43
+ awsRegion string
44
+ endpointURL string
45
+ local bool
46
+ noColor bool
47
+ mfa bool
48
+ level int
49
+ fullPath bool
50
+ fileName string
51
+ size bool
52
+ humanReadable bool
53
+ dateTime bool
54
+ username bool
55
+ directoryOnly bool
56
+ pattern string
57
57
inversePattern string
58
+ noReport bool
58
59
)
59
60
60
61
var rootCmd = & cobra.Command {
@@ -85,7 +86,7 @@ var rootCmd = &cobra.Command{
85
86
if level > 0 {
86
87
maxDepth = & level
87
88
}
88
- keys , err := pkg .FetchS3ObjectKeys (s3Svc , bucket , prefix , maxDepth , size , humanReadable , dateTime , username ,pattern ,inversePattern )
89
+ keys , err := pkg .FetchS3ObjectKeys (s3Svc , bucket , prefix , maxDepth , size , humanReadable , dateTime , username , pattern , inversePattern )
89
90
if err != nil {
90
91
log .Fatalf ("failed to fetch S3 object keys: %v" , err )
91
92
return
@@ -112,14 +113,17 @@ var rootCmd = &cobra.Command{
112
113
log .Fatalf ("failed to output tree: %v" , err )
113
114
return
114
115
}
115
- fmt .Fprintf (f , "\n %d directories, %d files\n " , dirCount , fileCount )
116
-
116
+ if ! noReport {
117
+ fmt .Fprintf (f , "\n %d directories, %d files\n " , dirCount , fileCount )
118
+ }
117
119
} else {
118
120
if err := gtree .OutputProgrammably (os .Stdout , root ); err != nil {
119
121
log .Fatalf ("failed to output tree: %v" , err )
120
122
return
121
123
}
122
- fmt .Printf ("\n %d directories, %d files\n " , dirCount , fileCount )
124
+ if ! noReport {
125
+ fmt .Printf ("\n %d directories, %d files\n " , dirCount , fileCount )
126
+ }
123
127
}
124
128
},
125
129
}
@@ -149,6 +153,7 @@ func init() {
149
153
rootCmd .Flags ().BoolVarP (& directoryOnly , "directory-only" , "d" , false , "List directories only." )
150
154
rootCmd .Flags ().StringVarP (& pattern , "pattern" , "P" , "" , "List files that match the pattern." )
151
155
rootCmd .Flags ().StringVarP (& inversePattern , "inverse-pattern" , "I" , "" , "List files that do not match the pattern." )
156
+ rootCmd .Flags ().BoolVarP (& noReport , "noreport" , "" , false , "Omits printing of the file and directory report at the end of the tree listing." )
152
157
153
158
}
154
159
0 commit comments