diff --git a/pkg/generator/config.go b/pkg/generator/config.go new file mode 100644 index 0000000..70e0eb2 --- /dev/null +++ b/pkg/generator/config.go @@ -0,0 +1,42 @@ +/* +Copyright © 2021 Matt Rose + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package generator + +import "github.com/thediveo/enumflag" + +type UsageMode enumflag.Flag + +const ( + Remote UsageMode = iota + Local +) + +var UsageModeIDs = map[UsageMode][]string{ + Remote: {"remote"}, + Local: {"local"}, +} + +type Config struct { + Format string + + ExampleUsageMode *UsageMode +} diff --git a/pkg/generator/generator.go b/pkg/generator/generator.go index 3ff6f13..b9c47bb 100644 --- a/pkg/generator/generator.go +++ b/pkg/generator/generator.go @@ -23,7 +23,6 @@ package generator import ( "github.com/pkg/errors" - "github.com/thediveo/enumflag" "github.com/matty-rose/gha-docs/pkg/types" ) @@ -32,24 +31,6 @@ type Generator interface { Generate(action *types.CompositeAction) string } -type UsageMode enumflag.Flag - -const ( - Remote UsageMode = iota - Local -) - -var UsageModeIDs = map[UsageMode][]string{ - Remote: {"remote"}, - Local: {"local"}, -} - -type Config struct { - Format string - - ExampleUsageMode *UsageMode -} - func New(config Config) (Generator, error) { switch config.Format { case "markdown": diff --git a/pkg/generator/generator_test.go b/pkg/generator/generator_test.go index ccbe199..eae5ad2 100644 --- a/pkg/generator/generator_test.go +++ b/pkg/generator/generator_test.go @@ -32,8 +32,7 @@ import ( func TestInvalidFormat(t *testing.T) { t.Parallel() - var mode generator.UsageMode = generator.Remote - + mode := generator.Remote config := generator.Config{Format: "invalid", ExampleUsageMode: &mode} g, err := generator.New(config)