MCPcopy Create free account
hub / github.com/apache/incubator-pegasus / resetEncoding

Function resetEncoding

pegic/interactive/cmd/encoding.go:84–97  ·  view source on GitHub ↗

resetEncoding is the generic executor for the encoding-reset commands

(c *grumble.Context, encPtr *util.Encoder)

Source from the content-addressed store, hash-verified

82
83// resetEncoding is the generic executor for the encoding-reset commands
84func resetEncoding(c *grumble.Context, encPtr *util.Encoder) error {
85 if len(c.Args) != 1 {
86 return fmt.Errorf("invalid number (%d) of arguments for `encoding %s`", len(c.Args), c.Command.Name)
87 }
88
89 encoding := c.Args.String("ENCODING")
90 enc := util.NewEncoder(encoding)
91 if enc == nil {
92 return fmt.Errorf("uncognized encoding: %s", encoding)
93 }
94 *encPtr = enc
95 c.App.Println(globalContext)
96 return nil
97}
98
99func encodingCompleter(prefix string, args []string) []string {
100 return filterStringWithPrefix(supportedEncodings, prefix)

Callers 1

initFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected