Skip to content

Commit

Permalink
added terramate
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Mar 7, 2023
1 parent 27f5220 commit 01cb972
Show file tree
Hide file tree
Showing 24 changed files with 509 additions and 0 deletions.
30 changes: 30 additions & 0 deletions completers/terramate_completer/cmd/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var createCmd = &cobra.Command{
Use: "create",
Short: "Creates a stack on the project",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(createCmd).Standalone()

createCmd.Flags().StringSlice("after", []string{}, "Add a stack as after")
createCmd.Flags().StringSlice("before", []string{}, "Add a stack as before")
createCmd.Flags().String("description", "", "Description of the stack, defaults to the stack name")
createCmd.Flags().String("id", "", "ID of the stack, defaults to UUID")
createCmd.Flags().Bool("ignore-existing", false, "If the stack already exists do nothing and don't fail")
createCmd.Flags().StringSlice("import", []string{}, "Add import block for the given path on the stack")
createCmd.Flags().String("name", "", "Name of the stack, defaults to stack dir base name")
createCmd.Flags().Bool("no-generate", false, "Disable code generation for the newly created stack")
rootCmd.AddCommand(createCmd)

carapace.Gen(createCmd).PositionalCompletion(
carapace.ActionFiles(),
)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimentalCmd = &cobra.Command{
Use: "experimental",
Short: "Experimental features (may change or be removed in the future)",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimentalCmd).Standalone()

rootCmd.AddCommand(experimentalCmd)
}
23 changes: 23 additions & 0 deletions completers/terramate_completer/cmd/experimental_clone.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_cloneCmd = &cobra.Command{
Use: "clone",
Short: "Clones a stack",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_cloneCmd).Standalone()

experimentalCmd.AddCommand(experimental_cloneCmd)

carapace.Gen(experimental_cloneCmd).PositionalCompletion(
carapace.ActionDirectories(),
carapace.ActionDirectories(),
)
}
20 changes: 20 additions & 0 deletions completers/terramate_completer/cmd/experimental_eval.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_evalCmd = &cobra.Command{
Use: "eval",
Short: "Eval expression",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_evalCmd).Standalone()

experimental_evalCmd.Flags().Bool("as-json", false, "Outputs the result as a JSON value")
experimental_evalCmd.Flags().StringSliceP("global", "g", []string{}, "set/override globals. eg.: --global name=<expr>")
experimentalCmd.AddCommand(experimental_evalCmd)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental_generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_generateCmd = &cobra.Command{
Use: "generate",
Short: "Experimental generate commands",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_generateCmd).Standalone()

experimentalCmd.AddCommand(experimental_generateCmd)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental_generate_debug.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_generate_debugCmd = &cobra.Command{
Use: "debug",
Short: "Shows generate debug information",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_generate_debugCmd).Standalone()

experimental_generateCmd.AddCommand(experimental_generate_debugCmd)
}
20 changes: 20 additions & 0 deletions completers/terramate_completer/cmd/experimental_getConfigValue.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_getConfigValueCmd = &cobra.Command{
Use: "get-config-value",
Short: "Get configuration value",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_getConfigValueCmd).Standalone()

experimental_getConfigValueCmd.Flags().Bool("as-json", false, "Outputs the result as a JSON value")
experimental_getConfigValueCmd.Flags().StringSliceP("global", "g", []string{}, "set/override globals. eg.: --global name=<expr>")
experimentalCmd.AddCommand(experimental_getConfigValueCmd)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental_globals.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_globalsCmd = &cobra.Command{
Use: "globals",
Short: "List globals for all stacks",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_globalsCmd).Standalone()

experimentalCmd.AddCommand(experimental_globalsCmd)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental_metadata.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_metadataCmd = &cobra.Command{
Use: "metadata",
Short: "Shows metadata available on the project",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_metadataCmd).Standalone()

experimentalCmd.AddCommand(experimental_metadataCmd)
}
19 changes: 19 additions & 0 deletions completers/terramate_completer/cmd/experimental_partialEval.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_partialEvalCmd = &cobra.Command{
Use: "partial-eval",
Short: "Partial evaluate the expressions",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_partialEvalCmd).Standalone()

experimental_partialEvalCmd.Flags().StringSliceP("global", "g", []string{}, "set/override globals. eg.: --global name=<expr>")
experimentalCmd.AddCommand(experimental_partialEvalCmd)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental_runEnv.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_runEnvCmd = &cobra.Command{
Use: "run-env",
Short: "List run environment variables for all stacks",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_runEnvCmd).Standalone()

experimentalCmd.AddCommand(experimental_runEnvCmd)
}
24 changes: 24 additions & 0 deletions completers/terramate_completer/cmd/experimental_runGraph.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_runGraphCmd = &cobra.Command{
Use: "run-graph",
Short: "Generate a graph of the execution order",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_runGraphCmd).Standalone()

experimental_runGraphCmd.Flags().StringP("label", "l", "", "Label used in graph nodes (it could be either \"stack.name\" or \"stack.dir\"")
experimental_runGraphCmd.Flags().StringP("outfile", "o", "", "Output .dot file")
experimentalCmd.AddCommand(experimental_runGraphCmd)

carapace.Gen(experimental_runGraphCmd).FlagCompletion(carapace.ActionMap{
"outfile": carapace.ActionFiles(),
})
}
22 changes: 22 additions & 0 deletions completers/terramate_completer/cmd/experimental_runOrder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_runOrderCmd = &cobra.Command{
Use: "run-order",
Short: "Show the topological ordering of the stacks",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_runOrderCmd).Standalone()

experimentalCmd.AddCommand(experimental_runOrderCmd)

carapace.Gen(experimental_runOrderCmd).PositionalCompletion(
carapace.ActionDirectories(),
)
}
23 changes: 23 additions & 0 deletions completers/terramate_completer/cmd/experimental_trigger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_triggerCmd = &cobra.Command{
Use: "trigger",
Short: "Triggers a stack",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_triggerCmd).Standalone()

experimental_triggerCmd.Flags().String("reason", "", "Reason for the stack being triggered")
experimentalCmd.AddCommand(experimental_triggerCmd)

carapace.Gen(experimental_triggerCmd).PositionalCompletion(
carapace.ActionFiles(),
)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/experimental_vendor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_vendorCmd = &cobra.Command{
Use: "vendor",
Short: "Manages vendored Terraform modules",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_vendorCmd).Standalone()

experimentalCmd.AddCommand(experimental_vendorCmd)
}
25 changes: 25 additions & 0 deletions completers/terramate_completer/cmd/experimental_vendor_download.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var experimental_vendor_downloadCmd = &cobra.Command{
Use: "download",
Short: "Downloads a Terraform module and stores it on the project vendor dir",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(experimental_vendor_downloadCmd).Standalone()

experimental_vendor_downloadCmd.Flags().StringP("dir", "d", "", "dir to vendor downloaded project")
experimental_vendorCmd.AddCommand(experimental_vendor_downloadCmd)

carapace.Gen(experimental_vendor_downloadCmd).FlagCompletion(carapace.ActionMap{
"dir": carapace.ActionDirectories(),
})

// TODO positional completion
}
19 changes: 19 additions & 0 deletions completers/terramate_completer/cmd/fmt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var fmtCmd = &cobra.Command{
Use: "fmt",
Short: "Format all files inside dir recursively",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(fmtCmd).Standalone()

fmtCmd.Flags().Bool("check", false, "Lists unformatted files, exit with 0 if all is formatted, 1 otherwise")
rootCmd.AddCommand(fmtCmd)
}
18 changes: 18 additions & 0 deletions completers/terramate_completer/cmd/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var generateCmd = &cobra.Command{
Use: "generate",
Short: "Generate terraform code for stacks",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(generateCmd).Standalone()

rootCmd.AddCommand(generateCmd)
}
Loading

0 comments on commit 01cb972

Please sign in to comment.