-
-
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
2 changed files
with
50 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,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() | ||
} | ||
}), | ||
}) | ||
} |
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/present_completer/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |