diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2018-08-09 16:52:21 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2018-08-10 22:11:46 -0400 |
| commit | 22ae7244297c3b63cfb8f44e3a9be52286e629df (patch) | |
| tree | f3b643830254378c0c75e9bf2d0760f93b672720 /cmd | |
| parent | fbb3f3f9dde228494b8d91698d7e11b749d2b88e (diff) | |
Adding --chmod flag to explicitly set output file modes
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/gomplate/main.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cmd/gomplate/main.go b/cmd/gomplate/main.go index bde6eb46..c0ba8909 100644 --- a/cmd/gomplate/main.go +++ b/cmd/gomplate/main.go @@ -93,22 +93,27 @@ func newGomplateCmd() *cobra.Command { } func initFlags(command *cobra.Command) { - command.Flags().BoolVarP(&printVer, "version", "v", false, "print the version") + command.Flags().SortFlags = false + + command.Flags().StringArrayVarP(&opts.DataSources, "datasource", "d", nil, "`datasource` in alias=URL form. Specify multiple times to add multiple sources.") + command.Flags().StringArrayVarP(&opts.DataSourceHeaders, "datasource-header", "H", nil, "HTTP `header` field in 'alias=Name: value' form to be provided on HTTP-based data sources. Multiples can be set.") command.Flags().StringArrayVarP(&opts.InputFiles, "file", "f", []string{"-"}, "Template `file` to process. Omit to use standard input, or use --in or --input-dir") command.Flags().StringVarP(&opts.Input, "in", "i", "", "Template `string` to process (alternative to --file and --input-dir)") command.Flags().StringVar(&opts.InputDir, "input-dir", "", "`directory` which is examined recursively for templates (alternative to --file and --in)") + command.Flags().StringArrayVar(&opts.ExcludeGlob, "exclude", []string{}, "glob of files to not parse") + command.Flags().StringArrayVarP(&opts.OutputFiles, "out", "o", []string{"-"}, "output `file` name. Omit to use standard output.") command.Flags().StringVar(&opts.OutputDir, "output-dir", ".", "`directory` to store the processed templates. Only used for --input-dir") - - command.Flags().StringArrayVarP(&opts.DataSources, "datasource", "d", nil, "`datasource` in alias=URL form. Specify multiple times to add multiple sources.") - command.Flags().StringArrayVarP(&opts.DataSourceHeaders, "datasource-header", "H", nil, "HTTP `header` field in 'alias=Name: value' form to be provided on HTTP-based data sources. Multiples can be set.") + command.Flags().StringVar(&opts.OutMode, "chmod", "", "set the mode for output file(s). Omit to inherit from input file(s)") ldDefault := env.Getenv("GOMPLATE_LEFT_DELIM", "{{") rdDefault := env.Getenv("GOMPLATE_RIGHT_DELIM", "}}") command.Flags().StringVar(&opts.LDelim, "left-delim", ldDefault, "override the default left-`delimiter` [$GOMPLATE_LEFT_DELIM]") command.Flags().StringVar(&opts.RDelim, "right-delim", rdDefault, "override the default right-`delimiter` [$GOMPLATE_RIGHT_DELIM]") + + command.Flags().BoolVarP(&printVer, "version", "v", false, "print the version") } func main() { |
