-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1348 from rsteube/add-melt
added melt
- Loading branch information
Showing
10 changed files
with
176 additions
and
2 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,17 @@ | ||
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,18 @@ | ||
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,18 @@ | ||
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,18 @@ | ||
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,18 @@ | ||
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,17 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var helpCmd = &cobra.Command{ | ||
Use: "help", | ||
Short: "Help about any command", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(helpCmd).Standalone() | ||
rootCmd.AddCommand(helpCmd) | ||
} |
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,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var restoreCmd = &cobra.Command{ | ||
Use: "restore", | ||
Short: "Recreate a key using the given seed phrase", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(restoreCmd).Standalone() | ||
|
||
restoreCmd.Flags().BoolP("help", "h", false, "help for restore") | ||
restoreCmd.Flags().StringP("seed", "s", "", "Seed phrase (default \"-\")") | ||
rootCmd.AddCommand(restoreCmd) | ||
|
||
carapace.Gen(restoreCmd).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,36 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/net/ssh" | ||
"github.com/rsteube/carapace-bin/pkg/actions/os" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "melt", | ||
Short: "melt generates a seed phrase from an SSH key", | ||
Long: "https://github.com/charmbracelet/melt", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func Execute() error { | ||
return rootCmd.Execute() | ||
} | ||
func init() { | ||
carapace.Gen(rootCmd).Standalone() | ||
|
||
rootCmd.PersistentFlags().BoolP("help", "h", false, "help for melt") | ||
rootCmd.PersistentFlags().StringP("language", "l", "", "Language (default \"en\")") | ||
|
||
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ | ||
"language": os.ActionLanguages(), | ||
}) | ||
|
||
carapace.Gen(rootCmd).PositionalCompletion( | ||
carapace.Batch( | ||
carapace.ActionFiles(), | ||
ssh.ActionPrivateKeys(), | ||
).ToA(), | ||
) | ||
} |
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,7 @@ | ||
package main | ||
|
||
import "github.com/rsteube/carapace-bin/completers/melt_completer/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |
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