Skip to content

Commit

Permalink
added present
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Aug 12, 2023
1 parent 40e2958 commit 5d1bbe4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
43 changes: 43 additions & 0 deletions completers/present_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/net"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "present",
Short: "present implements parsing and rendering of present file",
Long: "https://pkg.go.dev/golang.org/x/tools/present",
Run: func(cmd *cobra.Command, args []string) {},
}

func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().StringS("base", "base", "", "base path for slide template and static resources")
rootCmd.Flags().StringS("content", "content", "", "base path for presentation content")
rootCmd.Flags().BoolN("help", "h", false, "show help")
rootCmd.Flags().StringS("http", "http", "", "HTTP service address")
rootCmd.Flags().BoolS("notes", "notes", false, "enable presenter notes")
rootCmd.Flags().StringS("orighost", "orighost", "", "host component of web origin URL")
rootCmd.Flags().BoolS("play", "play", false, "enable playground")
rootCmd.Flags().BoolS("use_playground", "use_playground", false, "run code snippets using play.golang.org")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"base": carapace.ActionDirectories(),
"content": carapace.ActionDirectories(),
"http": carapace.ActionMultiParts(":", func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 1:
return net.ActionPorts()
default:
return carapace.ActionValues()
}
}),
})
}
7 changes: 7 additions & 0 deletions completers/present_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/rsteube/carapace-bin/completers/present_completer/cmd"

func main() {
cmd.Execute()
}

0 comments on commit 5d1bbe4

Please sign in to comment.