Skip to content

Commit

Permalink
fix code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwelin committed May 5, 2020
1 parent 9d74648 commit 6d30b95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Usage
--------

```bash
20:55 $ ./alviss new-api
$ ./alviss new-api
NAME:
alviss new-api - Generates a new api project

Expand All @@ -48,6 +48,6 @@ Then just follow the instructions on the screen. It's that simple!

Compliments
--------
Special thanks goes to [Axfood It AB](https://www.axfood.se/) for letting me opensource this
Special thanks goes to [Axfood IT AB](https://www.axfood.se/) for letting me opensource this


12 changes: 6 additions & 6 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"github.com/urfave/cli"
)

type EnumValue struct {
type enumValue struct {
Enum []string
Default string
selected string
}

func (e *EnumValue) Set(value string) error {
func (e *enumValue) Set(value string) error {
for _, enum := range e.Enum {
if enum == value {
e.selected = value
Expand All @@ -25,7 +25,7 @@ func (e *EnumValue) Set(value string) error {
return fmt.Errorf("allowed values are %s", strings.Join(e.Enum, ", "))
}

func (e EnumValue) String() string {
func (e enumValue) String() string {
if e.selected == "" {
return e.Default
}
Expand Down Expand Up @@ -77,23 +77,23 @@ func runCLI(args []string) {
cli.GenericFlag{
Name: "t, api-type",
Usage: "api type (only rest supported for now)",
Value: &EnumValue{
Value: &enumValue{
Enum: []string{"rest"},
Default: "rest",
},
},
cli.GenericFlag{
Name: "e, api-endpoint",
Usage: "which endpoint type (either regional, edge or private)",
Value: &EnumValue{
Value: &enumValue{
Enum: []string{"regional", "edge", "private"},
Default: "regional",
},
},
cli.GenericFlag{
Name: "l, language",
Usage: "which language for lambda to be used (go, node, python, ruby)",
Value: &EnumValue{
Value: &enumValue{
Enum: []string{"go", "node", "python", "ruby"},
Default: "node",
},
Expand Down

0 comments on commit 6d30b95

Please sign in to comment.