-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
607 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var callCmd = &cobra.Command{ | ||
Use: "call [flags] [FUNCTION]...", | ||
Short: "Call a module function", | ||
GroupID: "module", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(callCmd).Standalone() | ||
|
||
callCmd.PersistentFlags().Bool("focus", false, "Only show output for focused commands") | ||
callCmd.PersistentFlags().Bool("json", false, "Present result as JSON") | ||
callCmd.PersistentFlags().StringP("mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a github repo (e.g. \"github.com/dagger/dagger/path/to/some/subdir\")") | ||
callCmd.PersistentFlags().StringP("output", "o", "", "Path in the host to save the result to") | ||
rootCmd.AddCommand(callCmd) | ||
|
||
carapace.Gen(callCmd).FlagCompletion(carapace.ActionMap{ | ||
"mod": dagger.ActionMods(), | ||
"output": carapace.ActionFiles(), | ||
}) | ||
|
||
carapace.Gen(callCmd).PositionalAnyCompletion( | ||
dagger.ActionFunctions(), | ||
) | ||
} |
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,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var completionCmd = &cobra.Command{ | ||
Use: "completion", | ||
Short: "Generate the autocompletion script for the specified shell", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(completionCmd).Standalone() | ||
|
||
rootCmd.AddCommand(completionCmd) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var completion_bashCmd = &cobra.Command{ | ||
Use: "bash", | ||
Short: "Generate the autocompletion script for bash", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(completion_bashCmd).Standalone() | ||
|
||
completion_bashCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions") | ||
completionCmd.AddCommand(completion_bashCmd) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var completion_fishCmd = &cobra.Command{ | ||
Use: "fish", | ||
Short: "Generate the autocompletion script for fish", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(completion_fishCmd).Standalone() | ||
|
||
completion_fishCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions") | ||
completionCmd.AddCommand(completion_fishCmd) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var completion_powershellCmd = &cobra.Command{ | ||
Use: "powershell", | ||
Short: "Generate the autocompletion script for powershell", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(completion_powershellCmd).Standalone() | ||
|
||
completion_powershellCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions") | ||
completionCmd.AddCommand(completion_powershellCmd) | ||
} |
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,19 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var completion_zshCmd = &cobra.Command{ | ||
Use: "zsh", | ||
Short: "Generate the autocompletion script for zsh", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(completion_zshCmd).Standalone() | ||
|
||
completion_zshCmd.Flags().Bool("no-descriptions", false, "disable completion descriptions") | ||
completionCmd.AddCommand(completion_zshCmd) | ||
} |
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,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var configCmd = &cobra.Command{ | ||
Use: "config", | ||
Short: "Get or set the configuration of a Dagger module", | ||
GroupID: "module", | ||
Aliases: []string{"mod"}, | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(configCmd).Standalone() | ||
configCmd.AddGroup( | ||
&cobra.Group{ID: "module", Title: ""}, | ||
) | ||
|
||
configCmd.PersistentFlags().Bool("focus", false, "Only show output for focused commands") | ||
configCmd.PersistentFlags().StringP("mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a github repo (e.g. \"github.com/dagger/dagger/path/to/some/subdir\")") | ||
rootCmd.AddCommand(configCmd) | ||
|
||
carapace.Gen(configCmd).FlagCompletion(carapace.ActionMap{ | ||
"mod": dagger.ActionMods(), | ||
}) | ||
} |
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,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var developCmd = &cobra.Command{ | ||
Use: "develop", | ||
Short: "Setup or update all the resources needed to develop on a module locally", | ||
GroupID: "module", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(developCmd).Standalone() | ||
|
||
developCmd.PersistentFlags().Bool("focus", false, "Only show output for focused commands") | ||
developCmd.PersistentFlags().StringP("mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a github repo (e.g. \"github.com/dagger/dagger/path/to/some/subdir\")") | ||
developCmd.Flags().String("sdk", "", "New SDK for the module") | ||
developCmd.Flags().String("source", "", "Directory to store the module implementation source code in") | ||
rootCmd.AddCommand(developCmd) | ||
|
||
carapace.Gen(developCmd).FlagCompletion(carapace.ActionMap{ | ||
"mod": dagger.ActionMods(), | ||
"sdk": dagger.ActionSdks(), | ||
"source": carapace.ActionDirectories(), | ||
}) | ||
} |
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,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var functionsCmd = &cobra.Command{ | ||
Use: "functions [flags] [FUNCTION]...", | ||
Short: "List available functions", | ||
GroupID: "module", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(functionsCmd).Standalone() | ||
|
||
functionsCmd.PersistentFlags().Bool("focus", false, "Only show output for focused commands") | ||
functionsCmd.PersistentFlags().StringP("mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a github repo (e.g. \"github.com/dagger/dagger/path/to/some/subdir\")") | ||
rootCmd.AddCommand(functionsCmd) | ||
|
||
carapace.Gen(functionsCmd).FlagCompletion(carapace.ActionMap{ | ||
"mod": dagger.ActionMods(), | ||
}) | ||
|
||
carapace.Gen(functionsCmd).PositionalAnyCompletion( | ||
dagger.ActionFunctions().FilterArgs(), | ||
) | ||
} |
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,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var genCmd = &cobra.Command{ | ||
Use: "gen FILE", | ||
Short: "Generate CLI reference documentation", | ||
Hidden: true, | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(genCmd).Standalone() | ||
|
||
genCmd.Flags().String("frontmatter", "", "Prepend content to beginning of generated file") | ||
genCmd.Flags().Bool("include-experimental", false, "Show experimental commands in the generated documentation") | ||
genCmd.Flags().StringP("output", "o", "", "Save to file") | ||
rootCmd.AddCommand(genCmd) | ||
|
||
carapace.Gen(genCmd).FlagCompletion(carapace.ActionMap{ | ||
"output": carapace.ActionFiles(), | ||
}) | ||
|
||
carapace.Gen(genCmd).PositionalCompletion( | ||
carapace.ActionFiles(), | ||
) | ||
} |
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,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var helpCmd = &cobra.Command{ | ||
Use: "help [command]", | ||
Short: "Help about any command", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(helpCmd).Standalone() | ||
|
||
rootCmd.AddCommand(helpCmd) | ||
|
||
carapace.Gen(helpCmd).PositionalAnyCompletion( | ||
carapace.ActionCommands(rootCmd), | ||
) | ||
} |
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,34 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var initCmd = &cobra.Command{ | ||
Use: "init [flags] [PATH]", | ||
Short: "Initialize a new Dagger module", | ||
GroupID: "module", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(initCmd).Standalone() | ||
|
||
initCmd.Flags().String("license", "", "License identifier to generate - see https://spdx.org/licenses/") | ||
initCmd.Flags().String("name", "", "Name of the new module (defaults to parent directory name)") | ||
initCmd.Flags().String("sdk", "", "Optionally initialize module for development in the given SDK") | ||
initCmd.Flags().String("source", "", "Directory to store the module implementation source code in (defaults to \"dagger/ if \"--sdk\" is provided)") | ||
rootCmd.AddCommand(initCmd) | ||
|
||
carapace.Gen(initCmd).FlagCompletion(carapace.ActionMap{ | ||
"license": dagger.ActionLicenses(), | ||
"sdk": dagger.ActionSdks(), | ||
"source": carapace.ActionDirectories(), | ||
}) | ||
|
||
carapace.Gen(initCmd).PositionalCompletion( | ||
carapace.ActionDirectories(), | ||
) | ||
} |
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,40 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/git" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var installCmd = &cobra.Command{ | ||
Use: "install [flags] MODULE", | ||
Short: "Add a new dependency to a Dagger module", | ||
GroupID: "module", | ||
Aliases: []string{"use"}, | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(installCmd).Standalone() | ||
|
||
installCmd.Flags().Bool("focus", false, "Only show output for focused commands") | ||
installCmd.Flags().StringP("mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a github repo (e.g. \"github.com/dagger/dagger/path/to/some/subdir\")") | ||
installCmd.Flags().StringP("name", "n", "", "Name to use for the dependency in the module. Defaults to the name of the module being installed.") | ||
rootCmd.AddCommand(installCmd) | ||
|
||
carapace.Gen(installCmd).FlagCompletion(carapace.ActionMap{ | ||
"mod": dagger.ActionMods(), | ||
}) | ||
|
||
carapace.Gen(installCmd).PositionalCompletion( | ||
carapace.ActionMultiPartsN("@", 2, func(c carapace.Context) carapace.Action { | ||
switch len(c.Parts) { | ||
case 0: | ||
return git.ActionRepositorySearch(git.SearchOpts{Github: true}) | ||
default: | ||
return git.ActionLsRemoteRefs(git.LsRemoteRefOption{Url: "https://" + c.Parts[0], Branches: true, Tags: true}) | ||
} | ||
}), | ||
) | ||
} |
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,39 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/net" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/dagger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var listenCmd = &cobra.Command{ | ||
Use: "listen", | ||
Short: "Starts the engine server", | ||
Aliases: []string{"l"}, | ||
Hidden: true, | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(listenCmd).Standalone() | ||
|
||
listenCmd.Flags().Bool("allow-cors", false, "allow Cross-Origin Resource Sharing (CORS) requests") | ||
listenCmd.Flags().Bool("disable-host-read-write", false, "disable host read/write access") | ||
listenCmd.PersistentFlags().Bool("focus", false, "Only show output for focused commands") | ||
listenCmd.Flags().String("listen", "", "Listen on network address ADDR") | ||
listenCmd.PersistentFlags().StringP("mod", "m", "", "Path to dagger.json config file for the module or a directory containing that file. Either local path (e.g. \"/path/to/some/dir\") or a github repo (e.g. \"github.com/dagger/dagger/path/to/some/subdir\")") | ||
rootCmd.AddCommand(listenCmd) | ||
|
||
carapace.Gen(listenCmd).FlagCompletion(carapace.ActionMap{ | ||
"listen": carapace.ActionMultiPartsN(":", 2, func(c carapace.Context) carapace.Action { | ||
switch len(c.Parts) { | ||
case 0: | ||
return carapace.ActionValues() | ||
default: | ||
return net.ActionPorts() | ||
} | ||
}), | ||
"mod": dagger.ActionMods(), | ||
}) | ||
} |
Oops, something went wrong.