faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

Reduce the number of package level variables

Open LucasRoesler opened this issue 6 years ago • 0 comments

Expected Behaviour

It would be nice/better if the CLI flag values were scoped to the methods being run instead of the package, e.g. we shouldn't expose the secretName variable to the deploy command.

Current Behaviour

Many (or all) of the CLI commands have flag values that are parsed by supplying a pointer to a package level variable, e.g.

cmd.Flags().StringVar(&name, "name", "", "Secret name")

Possible Solution

Flag values can be parsed and retrieved via the getter methods, for example

secretValue, err := cmd.Flags().GetString("from-literal")
if err != nil {
     return err
}

Context

This idea was discussed during teh review of #580

LucasRoesler avatar Jan 11 '19 11:01 LucasRoesler