glow: updates from v2.0.0

This commit is contained in:
rsteube 2024-12-20 18:00:05 +01:00
parent 1f3266097e
commit c5aa434d4e
10 changed files with 127 additions and 25 deletions

View File

@ -0,0 +1,18 @@
package cmd
import (
"github.com/carapace-sh/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)
}

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/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)
}

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/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)
}

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/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)
}

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/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)
}

View File

@ -13,5 +13,6 @@ var configCmd = &cobra.Command{
func init() {
carapace.Gen(configCmd).Standalone()
rootCmd.AddCommand(configCmd)
}

View File

@ -6,12 +6,17 @@ import (
)
var helpCmd = &cobra.Command{
Use: "help",
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),
)
}

View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var manCmd = &cobra.Command{
Use: "man",
Short: "Generates manpages",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(manCmd).Standalone()
rootCmd.AddCommand(manCmd)
}

View File

@ -10,7 +10,7 @@ import (
)
var rootCmd = &cobra.Command{
Use: "glow",
Use: "glow [SOURCE|DIR]",
Short: "Render markdown on the CLI, with pizzazz!",
Long: "https://github.com/charmbracelet/glow",
Run: func(cmd *cobra.Command, args []string) {},
@ -22,15 +22,16 @@ func Execute() error {
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.Flags().BoolP("all", "a", false, "show system files and directories (TUI-mode only)")
rootCmd.PersistentFlags().String("config", "", "config file")
rootCmd.Flags().BoolP("help", "h", false, "help for glow")
rootCmd.Flags().BoolP("local", "l", false, "show local files only; no network (TUI-mode only)")
rootCmd.Flags().BoolP("line-numbers", "l", false, "show line numbers (TUI-mode only)")
rootCmd.Flags().BoolP("mouse", "m", false, "enable mouse wheel (TUI-mode only)")
rootCmd.Flags().BoolP("pager", "p", false, "display with pager")
rootCmd.Flags().StringP("style", "s", "auto", "style name or JSON path")
rootCmd.Flags().BoolP("version", "v", false, "version for glow")
rootCmd.Flags().UintP("width", "w", 0, "word-wrap at width")
rootCmd.Flags().BoolP("preserve-new-lines", "n", false, "preserve newlines in the output")
rootCmd.Flags().StringP("style", "s", "", "style name or JSON path")
rootCmd.Flags().StringP("width", "w", "", "word-wrap at width (set to 0 to disable)")
rootCmd.Flag("mouse").Hidden = true
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"config": carapace.ActionFiles(".yml", ".yaml"),

View File

@ -1,18 +0,0 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var stashCmd = &cobra.Command{
Use: "stash",
Short: "Stash a markdown",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(stashCmd).Standalone()
stashCmd.PersistentFlags().StringP("memo", "m", "", "memo/note for stashing")
rootCmd.AddCommand(stashCmd)
}