(methods ...string)
| 152 | } |
| 153 | |
| 154 | func argsOutput(methods ...string) func(cmd *cobra.Command, args []string) error { |
| 155 | |
| 156 | var as []func(*cobra.Command, []string) error |
| 157 | |
| 158 | for _, method := range methods { |
| 159 | if method == "smb" { |
| 160 | as = append(as, argsSmbClient()) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | return args(append(as, func(*cobra.Command, []string) (err error) { |
| 165 | |
| 166 | if outputPath != "" { |
| 167 | if outputPath == "-" { |
| 168 | exec.Output.Writer = os.Stdout |
| 169 | |
| 170 | } else if exec.Output.Writer, err = os.OpenFile(outputPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644); err != nil { |
| 171 | log.Fatal().Err(err).Msg("Failed to open output file") |
| 172 | } |
| 173 | } |
| 174 | return |
| 175 | })...) |
| 176 | } |
no test coverage detected
searching dependent graphs…