-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: remove openapi command, replace with internal command
Generating the openapi spec is a developer operation, not an end-user operation. This PR removes the sub-command from the CLI and adds a new internal/openapigen command. This matches the pattern we use for generating the user documentation (internal/docsgen).
- Loading branch information
Showing
5 changed files
with
30 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/infrahq/infra/internal/server" | ||
) | ||
|
||
func main() { | ||
if err := run(os.Args[1:]); err != nil { | ||
fmt.Fprintln(os.Stderr, err.Error()) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func run(args []string) error { | ||
if len(args) < 1 { | ||
return fmt.Errorf("missing command line argument: path to openapi spec file") | ||
} | ||
filename := args[0] | ||
|
||
s := server.Server{} | ||
s.GenerateRoutes() | ||
|
||
return server.WriteOpenAPISpecToFile(filename) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters